Skip to content

Instantly share code, notes, and snippets.

View jiahut's full-sized avatar
🎯
Focusing

zhijia,.zhang jiahut

🎯
Focusing
View GitHub Profile
// Unmap undesired defaults
const unmaps = [
"sb", "sw", "ob",
"ow", "cp", ";cp",
";ap", "spa", "spb",
"spd", "sps", "spc",
"spi", "sfr", "zQ",
"zz", "zR", "ab",
"Q", "q", "ag",
"af", ";s", "yp",
@chenjie
chenjie / setup-an-ssr-server.md
Last active September 23, 2022 07:09
Deploy your own Shadowsocks(R) server with BBR TCP congestion control algorithm in less than 10 steps.

What is Shadowsocks(R)?

It is a fast and secure socks5 proxy designed to protect your Internet traffic. You can learn more here.
Long story short, it is a proxy that is commonly (and secretly) used in mainland China. People use it to access GFW blocked websites, such as Google, Facebook, etc. You can view a more detailed blocked website list here.

ss-diagram
Source: https://tumutanzi.com/archives/13005

What is BBR?

BBR ("Bottleneck Bandwidth and Round-trip propagation time") is a new congestion control algorithm developed at Google. Congestion control algorithms — running inside every computer, phone or tablet connected to a network — that decide how fast to send data. You can learn more [here](https://cloudplatform.googleblog.com/2017/07/TCP-BBR-congestion-control-come

@aarnone
aarnone / pbcopy-and-pbpaste-in-arch-linux.md
Created May 14, 2018 21:06
Get pbcopy and pbpaste in Arch Linux

Get pbcopy and pbpaste in Arch Linux

First you need the 'xsel' package.

$> pacman -S xsel

Then create aliases.

alias pbcopy='xsel --clipboard --input'

alias pbpaste='xsel --clipboard --output'

@ohpe
ohpe / MiTM-SSL.md
Created February 12, 2018 20:03
Simple SSL MiMT using stunnel

Simple SSL MiTM

A quick and dirty SSL MiTM using stunnel

  • Generate a SSL certificate .. or use Let's Encrypt (for the green lock)
openssl req -batch -new -x509 -days 365 -nodes -out mitm.pem -keyout mitm.pem
  • Run stunnel
@stepango
stepango / keyboard.lua
Last active January 7, 2024 18:01
Hammerspoon change layout from Russian to English
ctrlPressed = false
keyPressed = false
layoutWatcher = hs.eventtap.new({hs.eventtap.event.types.flagsChanged, hs.eventtap.event.types.keyUp}, function(e)
local flags = e:getFlags()
local keyCode = e:getKeyCode()
if flags.cmd and keyCode == 0x36 and not (flags.alt or flags.shift or flags.ctrl or flags.fn) then
ctrlPressed = true
keyPressed = false
elseif ctrlPressed and not (flags.cmd or flags.alt or flags.shift or flags.ctrl or flags.fn) and not keyPressed then
@yonglai
yonglai / playbook_centos_install_docker.yaml
Created November 15, 2017 18:04
An Ansible playbook to install docker-ce on Centos
---
- name: Install docker
gather_facts: No
hosts: default
tasks:
- name: Install yum utils
yum:
name: yum-utils
state: latest
@Adaephon-GH
Adaephon-GH / vim-vixen.json
Created November 9, 2017 22:51
Configuration for Vim-Vixen (FF Add-on)
{
"keymaps": {
"0": { "type": "scroll.home" },
":": { "type": "command.show" },
"o": { "type": "command.show.open", "alter": false },
"O": { "type": "command.show.open", "alter": true },
"t": { "type": "command.show.tabopen", "alter": false },
"T": { "type": "command.show.tabopen", "alter": true },
"w": { "type": "command.show.winopen", "alter": false },
"W": { "type": "command.show.winopen", "alter": true },
@platdrag
platdrag / Threadsafe_iter.py
Last active March 24, 2024 17:37
An example generic wrapper for making any iterator / generator thread-safe compatible with python 3
import threading
'''
A generic iterator and generator that takes any iterator and wrap it to make it thread safe.
This method was introducted by Anand Chitipothu in http://anandology.com/blog/using-iterators-and-generators/
but was not compatible with python 3. This modified version is now compatible and works both in python 2.8 and 3.0
'''
class threadsafe_iter:
"""Takes an iterator/generator and makes it thread-safe by
serializing call to the `next` method of given iterator/generator.
"""
@cyberang3l
cyberang3l / How to setup VirtualGL and TurboVNC on Ubuntu.md
Last active March 23, 2024 05:52
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding
@exupero
exupero / clipboard.clj
Created September 22, 2017 18:32
Clojure code to interact with the system clipboard
(refer-clojure :exclude '[slurp spit])
(import '[java.awt.datatransfer DataFlavor StringSelection Transferable])
(defn clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp []
(try
(.getTransferData (.getContents (clipboard) nil) (DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))