Skip to content

Instantly share code, notes, and snippets.

@zjx20
zjx20 / multi.sh
Last active June 6, 2022 08:20
broadcast input to multiple hosts simultaneously with tmux & zsh. idea from https://www.reddit.com/r/tmux/comments/lqp9sd/send_keystrokes_to_multiple_panes_like_iterm2/
# usage: multi ssh the-host{0,1,2}
function multi {
cmd=$1
shift
if [ -z "$TMUX" ]; then
session="multi-${cmd}-$(head -c 4 /dev/urandom | base64 | tr '/+' '_-' | tr -d '=')"
tmux new -d -s "${session}"
else
@zjx20
zjx20 / convert.sh
Last active February 7, 2024 02:04
Convert v2ray config.json (client side) to a subscription content
#!/bin/bash
# brew install jq
# brew install qrencode
config_file=v2rayx*.json
rss_file=rss.txt
cat $config_file | \
jq --raw-output '
@zjx20
zjx20 / TIPS.md
Last active April 30, 2023 07:28 — forked from Anachron/wg_install.sh
A script to spin up a Wireguard VPN server with Unbound recursive DNS in a hurry
  • enable bbrplus on debian 9 and above

    git clone https://github.com/Xaster/bbrplus-debian.git
    cd bbrplus-debian
    # run as root
    make && make install
    
    sysctl -w net.core.default_qdisc=fq

sysctl -w net.ipv4.tcp_congestion_control=bbrplus

@zjx20
zjx20 / README.md
Last active November 2, 2020 14:47 — forked from mildsunrise/README.md
Helper program to add HTTP/SOCKS proxy support to SSH

ssh-proxy-dialer

This program adds proxy support to ssh. Once installed, ssh will obey the ssh_proxy environment variable (or all_proxy as a fallback) and will try to connect to the server through that proxy. Example:

export ssh_proxy="socks5://10.139.2.1:8066"
ssh example.com  # will connect through SOCKS5 proxy
#!/usr/bin/env python
"""
xsync.py by zjx20
http://github.com/zjx20/xsync/
This script will watch a local directory and on change will
sync to a remote directory. The script can be easily modified
to do whatever you want on a change event.
requires: pip install 'watchdog==0.8.3'
@zjx20
zjx20 / apple-gmux.c
Last active August 29, 2021 08:38
patched apple-gmux.c for ubuntu on macbook pro 2017-mid with kernel v4.12.3
/*
* Gmux driver for Apple laptops
*
* Copyright (C) Canonical Ltd. <seth.forshee@canonical.com>
* Copyright (C) 2010-2012 Andreas Heider <andreas@meetr.de>
* Copyright (C) 2015 Lukas Wunner <lukas@wunner.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@zjx20
zjx20 / gist:1c7f4dd1392866f9d8b00dd2a05bd481
Last active February 2, 2024 19:07
kcptun install and systemd daemon
wget https://github.com/xtaci/kcptun/releases/download/v20170525/kcptun-linux-amd64-20170525.tar.gz
tar xvf kcptun-linux-amd64-20170525.tar.gz
sudo mv server_linux_amd64 /usr/local/bin/kcptun_server
sudo mv client_linux_amd64 /usr/local/bin/kcptun_client
sudo mkdir -p /etc/kcptun
sudo bash -c "cat <<EOT > /etc/kcptun/server_conf.json
{
\"listen\": \":4321\",
\"target\": \"127.0.0.1:8421\",
@zjx20
zjx20 / gist:89be7b45954844944d4ea9cc01c5d4f3
Last active December 5, 2018 16:15 — forked from Nerten/gist:399257dba4c36393c063
Aria2c daemon Ubuntu16.04
# should install aria2c from latest source
# requirements: sudo apt install libgnutls-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libcppunit-dev autoconf automake autotools-dev autopoint libtool
#sudo apt-get install -y aria2
sudo useradd aria2
sudo mkdir /aria2
sudo mkdir /aria2/dl
sudo mkdir /aria2/log
sudo touch /aria2/aria2.session
sudo bash -c "cat <<EOT > /aria2/aria2.conf
@zjx20
zjx20 / ssh-agent-for-github.sh
Last active May 4, 2017 07:43
A wrapper for enabling "SSH agent forwarding" for ssh command
#!/bin/bash
# Usage:
# 1. save this gist to some where
# 2. update your ssh command, like:
# /path/to/ssh-agent-for-github.sh ssh -A user@your-server
# 3. you should able to access github with your ssh key now, try "ssh -T git@github.com" to confirm it
# NOTICE: you may want to change this value!
GITHUB_SSH_KEY=~/.ssh/my_github_rsa
@zjx20
zjx20 / gist:fd6fa68bbf8b828d4109b8412b1d48ca
Created March 2, 2017 02:03 — forked from reidransom/gist:6042016
Auto-starting VirtualBox VMs on OS X

Auto-starting VirtualBox VMs on OS X

After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

Link to original article.

Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

sudo cp \

/Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \