Skip to content

Instantly share code, notes, and snippets.

View pandada8's full-sized avatar
🐟
摸鱼

pandada8 pandada8

🐟
摸鱼
View GitHub Profile
@pandada8
pandada8 / getch.py
Last active October 4, 2016 11:11
getch in terminal
import sys, tty, termios
def getch():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
if ch == '\x1b':
ch += sys.stdin.read(2)
@pandada8
pandada8 / client.json
Created October 30, 2016 13:30
v2ray websocket setup example
{
"log": {
"loglevel": "info"
},
"outboundDetour": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
}
@pandada8
pandada8 / clone.zsh
Last active November 19, 2016 12:29
clone.zsh
function clone::do_clone() {
local script="url='$1'
print('github' in url or 'bitbucket' in url)"
local need_proxy=$(python -c "$script")
local proxy="socks5://localhost:1080"
if [ "$need_proxy" = "True" ]; then
export {https,http,all}_proxy=$proxy
git clone "$1" "$2"
unset {https,http,all}_proxy
# based on the original config
from libqtile.config import Key, Screen, Group, Drag, Click
from libqtile.command import lazy
from libqtile import layout, bar, widget
from libqtile import hook
from libqtile.log_utils import logger
import os
import subprocess
@pandada8
pandada8 / debian-to-stretch.sh
Last active April 25, 2017 21:00
node-init.sh
sed -i "s/jessie/stretch/g" /etc/apt/sources.list && apt update -y && apt dist-upgrade -y && printf "net.ipv4.tcp_congestion_control=bbr\nnet.core.default_qdisc=fq" >> /etc/sysctl.conf
@pandada8
pandada8 / 1.sh
Last active March 2, 2017 11:38
debian init
sed -i "s/jessie/stretch/g" /etc/apt/sources.list && apt update -y && apt dist-upgrade -y && printf "net.ipv4.tcp_congestion_control=bbr\nnet.core.default_qdisc=fq" >> /etc/sysctl.conf
@pandada8
pandada8 / pass.py
Created June 13, 2017 01:03
dump pass
import subprocess
import glob
import json
import os
p = {}
os.chdir(os.path.expanduser("~/.password-store"))
for f in glob.glob("**/*.gpg", recursive=True):
name = os.path.splitext(f)[0]
print(name)
e = subprocess.check_output(["pass", name])
sudo apt install automake libssl-dev
@pandada8
pandada8 / clean_meteor_old_packages.py
Created July 22, 2017 11:28
Clean Meteor Old Packages With Python 3
import os
from distutils.version import LooseVersion
import shutil
path = os.path.expanduser('~/.meteor/packages')
for root, dirs, files in os.walk(path):
if root == path:
continue
version = sorted([i for i in dirs if i[0] != '.'], key=LooseVersion)
if len(version) > 1:
@pandada8
pandada8 / app.ini
Last active July 26, 2017 05:49
gogs setup guide
APP_NAME = panda
RUN_USER = git
RUN_MODE = prod
[attachment]
ENABLED = true
PATH = /home/pan/app/git-attachment
[session]
PROVIDER = file