Skip to content

Instantly share code, notes, and snippets.

View pandada8's full-sized avatar
🐟
摸鱼

pandada8 pandada8

🐟
摸鱼
View GitHub Profile
@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
# 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 / 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
@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 / 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 / main.md
Created September 24, 2016 01:48
preload in mac
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main() {
	srand(time(NULL));
	int i = 10;
	while (i --) {
 printf("%d\n", rand() * 100);
@pandada8
pandada8 / hepan.py
Last active September 18, 2016 01:19
import requests
import json
import time
import datetime
class MobCent():
def __init__(self):
@pandada8
pandada8 / install
Last active October 20, 2016 02:15
sudo apt install build-essential libncurses5-dev libreadline-dev zlib1g-dev liblzo2-dev libssl-dev -y
wget https://www.tinc-vpn.org/packages/tinc-1.1pre14.tar.gz && tar xvf tinc-1.1pre14.tar.gz && cd tinc-1.1pre14
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --sbindir=/usr/sbin --with-systemd=/etc/systemd/system
make
make install
sudo tinc -n panda init
sudo tinc -n panda edit tinc-up
sudo tinc -n panda add subnet 192.168.25.0
@pandada8
pandada8 / clone.py
Last active May 27, 2016 17:02
git clone helper
#!/bin/env python
import os
import sys
from urllib.parse import urlsplit
import subprocess
os.chdir(os.path.expanduser("~/repo/"))
def clone(url, folder):
os.makedirs(folder, exist_ok=True)
@pandada8
pandada8 / config.yml
Created May 24, 2016 06:20
Build A Docker Registry Mirror
version: 0.1
log:
level: debug
fields:
service: registry
storage:
cache:
layerinfo: inmemory
filesystem:
rootdirectory: /var/lib/registry