Blog

  • gpu-tutorial

    Visit original content creator repository
    https://github.com/dbeurle/gpu-tutorial

  • SocksProxySever

    关于

    Build Status Lines of code

    这是一个使用 Java 实现的 SOCKS4, SOCKS5 代理协议的代理服务器,本项目主要用来研究 SOCKS 代理协议, 该协议设计之初是为了让有权限的用户可以穿过内部局域网防火墙的限制,来访问外部资源。 这个代理服务器 可直接运行于 Windows 中, 该代理服务器目前已经在 360 极速浏览器,Firefox 浏览器,微信,QQ, 阿里钉钉中通过测试。

    运行环境

    本项目使用 NetBeans 配合 JDK 开发, NetBeans8.0 以及 JDK8.0 以上版本的均可以运行。 亦可使用其他集成开发环境, 例如 Eclipse, IntelliJ IDEA 配合使用 JDK8.0 以上版本均可构建此项目。

    使用注意事项:

    • 本项目的主方法位于 SocksProxySever.java 文件中。
    • 如果需要使用请修改包的名称和路径,将包名称定义为你的包名和将文件放置于你的路径。

    其他集成开发环境下载链接:

    更新日志

    • 增加用户名密码认证登录。
    • 修改用户名密码认证登录的逻辑问题。
    • 增加 SOCKS4 代理协议的支持。

    许可证

    本项目遵循 MIT 开源许可协议。

    MIT License
    
    Copyright (c) 2021 zhbi98
    
    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
    
    Visit original content creator repository https://github.com/OWON-LILLIPUT/SocksProxySever
  • k8s-galera-demo

    Visit original content creator repository
    https://github.com/cuseinovic/k8s-galera-demo

  • tg

    tg

    Join telegram chat

    Telegram terminal client.

    tg screenshot

    Features

    • view mediafiles: photo, video, voice/video notes, documents
    • ability to send pictures, documents, audio, video
    • reply, edit, forward, delete, send messages
    • stickers
    • notifications
    • record and send voice msgs
    • auto download files
    • toggle chats: pin/unpin, mark as read/unread, mute/unmute
    • message history
    • list contacts
    • show user status
    • secret chats
    • search
    • bots (bot keyboard)

    Requirements

    To use tg, you’ll need to have the following installed:

    Optional dependencies

    • terminal-notifier – for Mac (used by default). You can change it to dunst for Linux or any other notifications program (see NOTIFY_CMD in configuration)
    • ffmpeg – to record voice msgs and upload videos.
    • tdlib – in case of incompatibility with built in package. For example, macOS:
      brew install tdlib
      and then set in config TDLIB_PATH
    • urlview to choose urls when there is multiple in message, use URL_VIEW in config file to use another app (it should accept urls in stdin)
    • to open stickers and animated ones (thumbnail preview) you need to set in mailcap appropriate handler and have app which will open webp file:
      image/webp; mpv %s
    • ranger, nnn – can be used to choose file when sending, customizable with FILE_PICKER_CMD
    • fzf – to create groups and secret chats (used for single and multiple user selection)

    Installation

    From PyPI

    This option is recommended for production:

    pip3 install tg
    tg

    From sources

    This option is recommended for development:

    git clone https://github.com/paul-nameless/tg.git
    cd tg
    pip install python-telegram
    pip install .
    tg

    Using Docker

    Note that voice recordings and notifications won’t work when using Docker.

    docker run -it --rm ghcr.io/paul-nameless/tg

    From the AUR

    If you’re using Arch Linux, you can install tg through its AUR package:

    If you’re using the yay AUR helper, you can install the package with:

    yay -S telegram-tg

    If you want to use the latest developement version via the AUR you can find it here

    Configuration

    Config file should be stored at ~/.config/tg/conf.py. This is simple python file.

    Simple config:

    # should start with + (plus) and contain country code
    PHONE = "[phone number in international format]"

    Advanced configuration:

    All configurable variables can be found here

    import os
    
    # You can write anything you want here, file will be executed at start time
    # You can keep you sensitive information in password managers or gpg
    # encrypted files for example
    def get_pass(key):
        # retrieves key from password store
        return os.popen("pass show {} | head -n 1".format(key)).read().strip()
    
    
    PHONE = get_pass("i/telegram-phone")
    # encrypt you local tdlib database with the key
    ENC_KEY = get_pass("i/telegram-enc-key")
    
    # log level for debugging, info by default
    LOG_LEVEL = "DEBUG"
    # path where logs will be stored (all.log and error.log)
    LOG_PATH = os.path.expanduser("~/.local/share/tg/")
    
    # If you have problems with tdlib shipped with the client, you can install and
    # use your own, for example:
    TDLIB_PATH = "/usr/local/Cellar/tdlib/1.6.0/lib/libtdjson.dylib"
    
    # you can use any other notification cmd, it is simple python string which
    # can format title, msg, subtitle and icon_path paramters
    # In these exapmle, kitty terminal is used and when notification is pressed
    # it will focus on the tab of running tg
    NOTIFY_CMD = "/usr/local/bin/terminal-notifier -title {title} -subtitle {subtitle} -message {msg} -appIcon {icon_path} -sound default -execute '/Applications/kitty.app/Contents/MacOS/kitty @ --to unix:/tmp/kitty focus-tab --no-response -m title:tg'"
    
    # You can use your own voice recording cmd but it's better to use default one.
    # The voice note must be encoded with the Opus codec, and stored inside an OGG
    # container. Voice notes can have only a single audio channel.
    VOICE_RECORD_CMD = "ffmpeg -f avfoundation -i ':0' -c:a libopus -b:a 32k {file_path}"
    
    # You can customize chat and msg flags however you want.
    # By default words will be used for readability, but you can make
    # it as simple as one letter flags like in mutt or add emojies
    CHAT_FLAGS = {
        "online": "●",
        "pinned": "P",
        "muted": "M",
        # chat is marked as unread
        "unread": "U",
        # last msg haven't been seen by recipient
        "unseen": "✓",
        "secret": "🔒",
        "seen": "✓✓",  # leave empty if you don't want to see it
    }
    MSG_FLAGS = {
        "selected": "*",
        "forwarded": "F",
        "new": "N",
        "unseen": "U",
        "edited": "E",
        "pending": "...",
        "failed": "💩",
        "seen": "✓✓",  # leave empty if you don't want to see it
    }
    
    # use this app to open url when there are multiple
    URL_VIEW = 'urlview'
    
    # Specifies range of colors to use for drawing users with
    # different colors
    # this one uses base 16 colors which should look good by default
    USERS_COLORS = tuple(range(2, 16))
    
    # to use 256 colors, set range appropriately
    # though 233 looks better, because last colors are black and gray
    # USERS_COLORS = tuple(range(233))
    
    # to make one color for all users
    # USERS_COLORS = (4,)
    
    # cleanup cache
    # Values: N days, None (never)
    KEEP_MEDIA = 7
    
    FILE_PICKER_CMD = "ranger --choosefile={file_path}"
    # FILE_PICKER_CMD = "nnn -p {file_path}"
    
    MAILCAP_FILE = os.path.expanduser("~/.config/mailcap")
    
    DOWNLOAD_DIR = os.path.expanduser("~/Downloads/")  # copy file to this dir

    Mailcap file

    Mailcap file is used for deciding how to open telegram files (docs, pics, voice notes, etc.). Path to the file can be overriden with MAILCAP_FILE in config file.

    Example: ~/.mailcap

    # media
    video/*; mpv "%s"
    audio/ogg; mpv --speed=1.33 "%s"
    audio/mpeg; mpv --no-video "%s"
    image/*; qview "%s"
    
    # text
    text/html; w3m "%s"
    text/html; open -a Firefox "%s"
    text/plain; less "%s"
    
    # fallback to vim
    text/*; vim "%s"

    Keybindings

    vi like keybindings are used in the project. Can be used commands like 4j – 4 lines down.

    For navigation arrow keys also can be used.

    Chats:

    • j,k: move up/down
    • J,K: move 10 chats up/down
    • g: go to top chat
    • l: open msgs of the chat
    • m: mute/unmute current chat
    • p: pin/unpin current chat
    • u: mark read/unread
    • r: read current chat
    • c: show list of contacts
    • dd: delete chat or remove history
    • ng: create new group chat
    • ns: create new secret chat
    • /: search in chats
    • ?: show help

    Msgs:

    • j,k: move up/down
    • J,K: move 10 msgs up/down
    • G: move to the last msg (at the bottom)
    • D: download file
    • l: if video, pics or audio then open app specified in mailcap file, for example:
      # Images
      image/png; qView "%s"
      audio/*; mpv "%s"
      if text, open in less (to view multiline msgs)
    • e: edit current msg
    • <space>: select msg and jump one msg down (use for deletion or forwarding)
    • <ctrl+space>: same as space but jumps one msg up
    • y: yank (copy) selected msgs with to internal buffer (for forwarding) and copy current msg text or path to file to clipboard
    • p: forward (paste) yanked (copied) msgs to current chat
    • dd: delete msg for everybody (multiple messages will be deleted if selected)
    • i or a: insert mode, type new message
    • I or A: open vim to write long msg and send
    • v: record and send voice message
    • r,R: reply to a current msg
    • S: calls a file picker
    • sv: send video
    • sa: send audio
    • sp: send picture
    • sd: send document
    • o: open url present in message (if multiple urls, urlview will be opened)
    • ]: next chat
    • [: prev chat
    • u: show user info (username, bio, phone, etc.)
    • c: show chat info (e.g. secret chat encryption key, chat id, state, etc.)
    • ?: show help
    • !: open msg with custom cmd

    Publish

    Run task to automatically increase version and release (https://taskfile.dev):

    task release
    Visit original content creator repository https://github.com/paul-nameless/tg
  • tg

    tg

    Join telegram chat

    Telegram terminal client.

    tg screenshot

    Features

    • view mediafiles: photo, video, voice/video notes, documents
    • ability to send pictures, documents, audio, video
    • reply, edit, forward, delete, send messages
    • stickers
    • notifications
    • record and send voice msgs
    • auto download files
    • toggle chats: pin/unpin, mark as read/unread, mute/unmute
    • message history
    • list contacts
    • show user status
    • secret chats
    • search
    • bots (bot keyboard)

    Requirements

    To use tg, you’ll need to have the following installed:

    Optional dependencies

    • terminal-notifier – for Mac (used by default). You can change it to dunst for Linux or any other notifications program (see NOTIFY_CMD in configuration)
    • ffmpeg – to record voice msgs and upload videos.
    • tdlib – in case of incompatibility with built in package. For example, macOS:
      brew install tdlib
      and then set in config TDLIB_PATH
    • urlview to choose urls when there is multiple in message, use URL_VIEW in config file to use another app (it should accept urls in stdin)
    • to open stickers and animated ones (thumbnail preview) you need to set in mailcap appropriate handler and have app which will open webp file:
      image/webp; mpv %s
    • ranger, nnn – can be used to choose file when sending, customizable with FILE_PICKER_CMD
    • fzf – to create groups and secret chats (used for single and multiple user selection)

    Installation

    From PyPI

    This option is recommended for production:

    pip3 install tg
    tg

    From sources

    This option is recommended for development:

    git clone https://github.com/paul-nameless/tg.git
    cd tg
    pip install python-telegram
    pip install .
    tg

    Using Docker

    Note that voice recordings and notifications won’t work when using Docker.

    docker run -it --rm ghcr.io/paul-nameless/tg

    From the AUR

    If you’re using Arch Linux, you can install tg through its AUR package:

    If you’re using the yay AUR helper, you can install the package with:

    yay -S telegram-tg

    If you want to use the latest developement version via the AUR you can find it here

    Configuration

    Config file should be stored at ~/.config/tg/conf.py. This is simple python file.

    Simple config:

    # should start with + (plus) and contain country code
    PHONE = "[phone number in international format]"

    Advanced configuration:

    All configurable variables can be found here

    import os
    
    # You can write anything you want here, file will be executed at start time
    # You can keep you sensitive information in password managers or gpg
    # encrypted files for example
    def get_pass(key):
        # retrieves key from password store
        return os.popen("pass show {} | head -n 1".format(key)).read().strip()
    
    
    PHONE = get_pass("i/telegram-phone")
    # encrypt you local tdlib database with the key
    ENC_KEY = get_pass("i/telegram-enc-key")
    
    # log level for debugging, info by default
    LOG_LEVEL = "DEBUG"
    # path where logs will be stored (all.log and error.log)
    LOG_PATH = os.path.expanduser("~/.local/share/tg/")
    
    # If you have problems with tdlib shipped with the client, you can install and
    # use your own, for example:
    TDLIB_PATH = "/usr/local/Cellar/tdlib/1.6.0/lib/libtdjson.dylib"
    
    # you can use any other notification cmd, it is simple python string which
    # can format title, msg, subtitle and icon_path paramters
    # In these exapmle, kitty terminal is used and when notification is pressed
    # it will focus on the tab of running tg
    NOTIFY_CMD = "/usr/local/bin/terminal-notifier -title {title} -subtitle {subtitle} -message {msg} -appIcon {icon_path} -sound default -execute '/Applications/kitty.app/Contents/MacOS/kitty @ --to unix:/tmp/kitty focus-tab --no-response -m title:tg'"
    
    # You can use your own voice recording cmd but it's better to use default one.
    # The voice note must be encoded with the Opus codec, and stored inside an OGG
    # container. Voice notes can have only a single audio channel.
    VOICE_RECORD_CMD = "ffmpeg -f avfoundation -i ':0' -c:a libopus -b:a 32k {file_path}"
    
    # You can customize chat and msg flags however you want.
    # By default words will be used for readability, but you can make
    # it as simple as one letter flags like in mutt or add emojies
    CHAT_FLAGS = {
        "online": "●",
        "pinned": "P",
        "muted": "M",
        # chat is marked as unread
        "unread": "U",
        # last msg haven't been seen by recipient
        "unseen": "✓",
        "secret": "🔒",
        "seen": "✓✓",  # leave empty if you don't want to see it
    }
    MSG_FLAGS = {
        "selected": "*",
        "forwarded": "F",
        "new": "N",
        "unseen": "U",
        "edited": "E",
        "pending": "...",
        "failed": "💩",
        "seen": "✓✓",  # leave empty if you don't want to see it
    }
    
    # use this app to open url when there are multiple
    URL_VIEW = 'urlview'
    
    # Specifies range of colors to use for drawing users with
    # different colors
    # this one uses base 16 colors which should look good by default
    USERS_COLORS = tuple(range(2, 16))
    
    # to use 256 colors, set range appropriately
    # though 233 looks better, because last colors are black and gray
    # USERS_COLORS = tuple(range(233))
    
    # to make one color for all users
    # USERS_COLORS = (4,)
    
    # cleanup cache
    # Values: N days, None (never)
    KEEP_MEDIA = 7
    
    FILE_PICKER_CMD = "ranger --choosefile={file_path}"
    # FILE_PICKER_CMD = "nnn -p {file_path}"
    
    MAILCAP_FILE = os.path.expanduser("~/.config/mailcap")
    
    DOWNLOAD_DIR = os.path.expanduser("~/Downloads/")  # copy file to this dir

    Mailcap file

    Mailcap file is used for deciding how to open telegram files (docs, pics, voice notes, etc.). Path to the file can be overriden with MAILCAP_FILE in config file.

    Example: ~/.mailcap

    # media
    video/*; mpv "%s"
    audio/ogg; mpv --speed=1.33 "%s"
    audio/mpeg; mpv --no-video "%s"
    image/*; qview "%s"
    
    # text
    text/html; w3m "%s"
    text/html; open -a Firefox "%s"
    text/plain; less "%s"
    
    # fallback to vim
    text/*; vim "%s"

    Keybindings

    vi like keybindings are used in the project. Can be used commands like 4j – 4 lines down.

    For navigation arrow keys also can be used.

    Chats:

    • j,k: move up/down
    • J,K: move 10 chats up/down
    • g: go to top chat
    • l: open msgs of the chat
    • m: mute/unmute current chat
    • p: pin/unpin current chat
    • u: mark read/unread
    • r: read current chat
    • c: show list of contacts
    • dd: delete chat or remove history
    • ng: create new group chat
    • ns: create new secret chat
    • /: search in chats
    • ?: show help

    Msgs:

    • j,k: move up/down
    • J,K: move 10 msgs up/down
    • G: move to the last msg (at the bottom)
    • D: download file
    • l: if video, pics or audio then open app specified in mailcap file, for example:
      # Images
      image/png; qView "%s"
      audio/*; mpv "%s"
      if text, open in less (to view multiline msgs)
    • e: edit current msg
    • <space>: select msg and jump one msg down (use for deletion or forwarding)
    • <ctrl+space>: same as space but jumps one msg up
    • y: yank (copy) selected msgs with to internal buffer (for forwarding) and copy current msg text or path to file to clipboard
    • p: forward (paste) yanked (copied) msgs to current chat
    • dd: delete msg for everybody (multiple messages will be deleted if selected)
    • i or a: insert mode, type new message
    • I or A: open vim to write long msg and send
    • v: record and send voice message
    • r,R: reply to a current msg
    • S: calls a file picker
    • sv: send video
    • sa: send audio
    • sp: send picture
    • sd: send document
    • o: open url present in message (if multiple urls, urlview will be opened)
    • ]: next chat
    • [: prev chat
    • u: show user info (username, bio, phone, etc.)
    • c: show chat info (e.g. secret chat encryption key, chat id, state, etc.)
    • ?: show help
    • !: open msg with custom cmd

    Publish

    Run task to automatically increase version and release (https://taskfile.dev):

    task release
    Visit original content creator repository https://github.com/paul-nameless/tg
  • SAA_2019_Bayes_CAR

    SAA 2019 – Bayesian Hierarchical ICAR Model

    April 11th, 2019 @ Albuquerque, NM

    2019/04/14 – Post confernece note:

    Thank you for visiting this repo/poster. The code is in the process of reorganization and a little tidying. The poster is in the poster folder. I will issue a DOI and do a github release when the code is relatively acceptable. Please let me know if you have any questions. Thanks!

    Session:

    Novel Statistical Techniques in Archaeology II (QUANTARCH II) (Sponsored by SAA QUANTARCH Interest Group)

    Title:

    Estimating the Effect of Endogenous Spatial Dependency with a Hierarchical Bayesian ICAR Model on Archaeological Site Location Data

    Authors:

    Matthew Harris & Mary Lennon

    Abstract:

    This research presents a method to test the endogenous spatial correlation effect when modeling the landscape sensitivity for archaeological sites. The effects of endogenous spatial correlation are inferred using a Hierarchical Bayesian model with a Intrinsic Conditional Auto-Regressive (ICAR) component to better understand the importance of modeling spatial cultural process. In current practice, effects of endogenous spatial autocorrelation are rarely explicitly incorporated into quantitative archaeological predictive models. This is due in part to the difficulties of measuring how cultural process relate across space and time, as well as accepting the assumption that geographically near sites are implicitly more related than distant sites. Typically these difficulties are side-stepped by including aspects of cultural processes as features and ignoring endogenous spatial correlation by assuming sites are spatially independent phenomena. While there are benefits to this approach, aside from convenience, the validity of either of these assumptions has not previously been tested. The approach developed here leads to better understanding the penalty for assuming spatial independence and the development of methods to model spatial cultural process.

    Graphical Abstract:

    Image


    TO DO:

    Research

    ☑️ – read sources below

    Data Prep.

    ☑️ – create simulated environments

    ☑️ – create simulated sites

    ☑️ – create fishnet grid (octagonal fishnet)

    ☑️ – calculate target (as count)

    ☑️ – Framework of probabilistic model

    ☑️ – gather data from real-world test case

    Code

    ☑️ – simulations

    ☑️ – Stan model

    ☑️ – evlaution of simulations

    ☑️ – test on real data

    Writing

    ☑️ – poster text

    Poster/Graphics

    ☑️ – plots

    ☑️ – layout/design

    ☑️ – printing

    Resources:

    Visit original content creator repository https://github.com/mrecos/SAA_2019_Bayes_CAR
  • e53-python-project-gym

    Python gym booking App

    First project in Python

    Includes (but not limited to):

    Members screen

    Screenshot 2022-02-09 171432

    Book classes through member

    Screenshot 2022-02-09 171524

    Run commands

    SQL commands while in GYM_APP directory:

    • createdb gym

    • psql -d gym -f db/gym_manager.sql

    • psql -d gym

    Python commands (if desired):

    • python3 console.py ## To run seeded data as example of members and classes ##

    Other commands:

    Brief:

    Gym

    A local gym has asked you to build a piece of software to help them to manage memberships, and register members for classes.

    MVP

    The app should allow the gym to create and edit Members The app should allow the gym to create and edit Classes The app should allow the gym to book members on specific classes The app should show a list of all upcoming classes The app should show all members that are booked in for a particular class Inspired By Glofox, Pike13

    Possible Extensions

    Classes could have a maximum capacity, and users can only be added while there is space remaining. The gym could be able to give its members Premium or Standard membership. Standard members can only be signed up for classes during off-peak hours. The Gym could mark members and classes as active/deactivated. Deactivated members/classes will not appear when creating bookings.

    Technologies used:

    Pyhton3, Flask, Jinja, CSS3, HTML5, PostgresQL

    Visit original content creator repository https://github.com/StrtMilne/e53-python-project-gym
  • falcon-base-services

    Falcon Base Services

    Many WordPress developers long for features like Eloquent, Blade, Service Container, and Service Provider to help them build powerful plugins. Falcon is here to change the game and bring these capabilities to your fingertips.

    Please note: This plugin provides a series of services and is not intended to be used as a base for creating new plugins.

    Features

    • Powerful Service Container and Service Provider
    • Query Builder
    • Eloquent
    • Template Engine (Blade, Twig)
    • Logger (Monolog)
    • Email (PHPMailer)
    • Laravel Validation
    • Request Handling
    • Scheduler
    • Environment Management
    • Symfony Var-Dumper (dd, dump)
    • Carbon
    • Additional Helpers to develop your plugin fast.

    Minimum PHP version: 8.2

    Installation

    1. Create Directory: In the wp-content folder, if the mu-plugins folder does not exist, create it. Place the falcon-base-services folder inside it.

    2. Create Loader File: In the root of the mu-plugins folder, create a PHP file with a name of your choice and add the following code:

      <?php
      require 'falcon-base-services/falcon-base-services.php';

      Note that the contents of the mu-plugins folder do not need to be activated in the WordPress admin and are executed before all other plugins. Also, WordPress does not scan the folders inside mu-plugins unless explicitly instructed.

    3. Install Dependencies: Open the terminal in the falcon-base-services folder and run the following command:

      composer install

      If you haven’t installed Composer, you can download and install it from this link.

    The plugin is now ready to use. Let’s explore its features and how to use them.

    Maintenance Mode

    If you need to put the site in maintenance mode, simply rename the maintenance.example.php file in the storage folder to maintenance.php. You can also edit the contents of the file as needed.

    Environment Variables (ENV)

    Items mentioned in the .env.example file are important. Rename the file to .env.

    get

    You can set your variables in the .env file and use them anywhere in your code like this:

    $_ENV['item'];
    //or
    env('item')

    set

    To set an item in the global $_ENV var, you can use:

    setEnv($key, $value);

    Config

    You can also use configuration files in your project that return an array.
    Place the configuration file in the config folder and access the desired values using the falconConfig($file, $key = null, $folder_path = null) function.

    • $file: The name of the configuration file.

    • $key: The key of the requested array. If null, the entire file content is returned.

    • $folder_path: By default, the path to the configuration files is in the config folder. If you want to have new configurations in your project, you can also specify the path to the new folder.

    Service Container – Service Provider

    The plugin uses a powerful service container with autowiring capabilities.

    • Singleton Services: Register a singleton service using:

      FALCON_CONTAINER->singleton(Test::class);
      // or
      FALCON_CONTAINER->singleton('test', Test::class);
    • Non-Singleton Services: Register a non-singleton service using:

      FALCON_CONTAINER->bind(Test::class);
      // or
      FALCON_CONTAINER->bind('test', Test::class);
    • Using Closures: You can also use closures:

      FALCON_CONTAINER->bind('test', function() { return Test::class; });
    • Using the Services: Use the get method to retrieve the services:

      FALCON_CONTAINER->get('test');
      FALCON_CONTAINER->get(Test::class);
    • Resolving Methods: Resolve a method from a class using:

      FALCON_CONTAINER->getMethod(Test::class, 'run');

      This will automatically resolve any dependencies required by both the class and the method.

    To create a service provider, create a class in the app/providers folder and extend the ServiceProvider class. Use the register and boot methods as needed. Then, add the provider’s address in the providers.php file located in the bootstrap folder.

    Eloquent, QueryBuilder

    All default WordPress tables are available as models in the app/Model folder. WooCommerce tables will be added soon. You can use both the powerful Query Builder and Eloquent to interact with these tables.

    • Eloquent:
    (new \FalconBaseServices\Model\Post())->published()->with('author')->get();
    • Query Builder:

    falconDB()::table('wp_posts')
        ->where('post_status', 'publish')
        ->leftJoin('wp_users', 'wp_posts.post_author', '=', 'wp_users.ID')
        ->select('wp_posts.*', 'wp_users.user_nicename')
        ->get();

    If you want to use a new table as a model, create its class by extending the FalconBaseServices\Model\BaseModel class. If the table does not use the default prefix, set $with_prefix to false:

    protected $with_prefix = false;

    The rules and usage of models and Query Builder/Eloquent are exactly like the Laravel documentation.

    Template

    By default, Blade is used as the template engine, which is slightly different in usage from the standard. Pay attention to the example:

    falconTemplate()->setViewDir('path to dir')->setView('name of file without extension')
    ->share(['item' => 'value'])->render();

    You can also use Twig. The class derived from the interface app/Services/TemplateEngine/Template.php is available in the path app/Services/TemplateEngine/Implements/Twig.php. Simply add Twig to the plugin via Composer and then edit the file app/Providers/TemplateServiceProvider.php.
    The usage is similar to the above example.

    Logger

    To use the logger, use falconLogger():

    falconLogger()->error('message', ['data' => 'value']);

    If you want the ProcessIdProcessor, GitProcessor, and MemoryUsageProcessor to be included in the log, set related items in .env file to true.

    Email

    To use email, you can use falconEmail():

    falconEmail()->send($to, $subject, $content, $from = null, $bcc = null);

    For more information on how to use email, refer to the file app/Services/Sender/Implements/Email/PHPMailer.php.

    Happy coding! 🚀

    Visit original content creator repository
    https://github.com/hesam-mousavi/falcon-base-services

  • beefweb

    beefweb

    Web interface plugin for DeaDBeeF and foobar2000 music players.

    License Build Status

    Features

    • Lightweight web user interface
    • Playback control
    • Playlist management
    • Music directory browser
    • Real-time UI updates
    • Mobile-friendly responsive design
    • REST-like API for controlling player from your application

    Browser support

    • Any recent browser should work
    • Due to high development effort required Internet Explorer of any version is not supported

    Downloads

    Check out releases section.

    How to install

    DeaDBeeF

    Unpack ddb_beefweb-*.tar.xz to $HOME/.local/lib/deadbeef.

    Alternatively if you use universal deadbeef-static_*.deb package you can install matching universal deb of beefweb:

    $ sudo dpkg -i deadbeef-beefweb_*.deb
    

    foobar2000

    Open foo_beefweb-*.fb2k-component with foobar2000, you will be asked to install the plugin.

    How to use

    Point your browser to http://localhost:8880 and enjoy your web interface.

    If you’ve enabled remote connections on plugin configuration screen you’ll be able to connect from remote machines as well.

    To allow browsing and adding files via web interface specify music directories in plugin configuration screen. For DeaDBeeF multiple music directories should be separated with ;.

    See advanced configuration guide to unlock hidden developer features.

    Donations

    If you like this project feel free to donate. Any amount is appreciated.

    Peer projects

    beefweb_dotnet project provides command line client as well as client library for .NET.

    Screenshots

    Main web interface on Linux

    Configuration screen for DeaDBeeF

    Main web interface on Windows

    Configuration screen for foobar2000

    How to build

    See building instructions.

    HTTP API

    Swagger API definition is available.

    Visit original content creator repository https://github.com/hyperblast/beefweb
  • spip3

    spip3

    01 novembre 2017
    —- Voila les fichiers pour créer entièrement un serveur nginx avec une base de donnée mariadb et spip3 d’installé.

    Pour l’utiliser:

    • récupérer les fichiers

    • récupérer (ou créer) le répertoire etc. Il contient les fichiers de configurations de mariadb et de nginx. Pour le serveur web, c’est une configuration minimal, mais qui fonctionne.

    • dans le même répertoire, créer un sous- répertoire maria (il contiendra la base de donnée -> modifiable dans le fichier docker-compose.yml

    • modifier les valeur:

      • MYSQL_ROOT_PASSWORD
      • MYSQL_USER
      • MYSQL_PASSWORD
      • SPIP_DB_PASS
      • SPIP_ADMIN_NAME
      • SPIP_ADMIN_LOGIN
      • SPIP_ADMIN_EMAIL
      • SPIP_ADMIN_PASS
    • Créer les container avec ./Redockerise.sh (c’est un petit script qui évite de tout retaper à la main)

    • Si tout c’est bien passé, vous pouvez lancer le tout avec “docker-compose up”

    Base de donnée avec SPIP: dans le panneau de configuration, à la demande du type de base, indiquer mysql, et pour l’adresse de connexion, mettez 172.21.0.20.
    Les containers sont configurés pour avoir toujours les même adresses ip:

    • php-fpm: 172.21.0.10
    • mariadb: 172.21.0.20
    • nginx: 172.21.0.30 (en intern, après, le port 80 est exposé sur 0.0.0.0)

    Normalement, cela doit fonctionner.

    26 octobre 2017
    —- Apres un mois de travail, voila spip3 qui tourne avec mariadb / php-fpm / nginx

    Le tout dans 3 containers différents.

    Visit original content creator repository
    https://github.com/rsuinux/spip3