Skip to content

Instantly share code, notes, and snippets.

@jackyyf
jackyyf / wireguard.if-post-down
Created July 30, 2018 11:40
ifupdown helper for wireguard
#!/bin/bash -e
#
# wireguard helper script
#
IP=/sbin/ip
if [ "$IF_WG_CONF" -o "$IF_WG_PRIVATE_KEY" ]
then
$IP link del $IFACE
@jackyyf
jackyyf / lim.sh
Created July 25, 2014 17:50
Gist by paste.py @ 2014-07-26 01:50:04.495803
#!/bin/bash
# ==============================================================
# CPU limit daemon - set PID's max. percentage CPU consumptions
# ==============================================================
# Variables
CPU_LIMIT=3 # Maximum percentage CPU consumption by each PID
DAEMON_INTERVAL=3 # Daemon check interval in seconds
BLACK_PROCESSES_LIST="sshd" # Limit only processes defined in this variable. If variable is empty (default) all violating processes are limited.
WHITE_PROCESSES_LIST= # Limit all processes except processes defined in this variable. If variable is empty (default) all violating processes are limited.
@jackyyf
jackyyf / generate.php
Created July 3, 2014 09:56
OpenVPN Config Generator!
<?php
error_reporting(0);
#######################
# General Config. #
#######################
$keys_tmp_dir = '/home/freenet/keys-tmp';
$keys_dir_prefix = '/home/freenet/keys'; /* Place to store keys. */
import sys; reload(sys); sys.setdefaultencoding('utf-8'); del sys.setdefaultencoding
from pyblake2 import blake2s
GLOBAL_LUCKY = 'j3xyAxdP4vXAecJy'
PENALTY_BASE = 1 << 252
results = []
with open('forms.txt') as f:
#! /bin/bash
### BEGIN INIT INFO
# Provides: ipv6
# Required-Start: $local_fs $all
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the ipv6 tunnel
# Description: ipv6 tunnel start-stop-daemon
@jackyyf
jackyyf / fuck_tcpsock.go
Created July 27, 2017 05:28
Fuck you golang.
package main
import (
"reflect"
"net"
)
func main() {
addr, err := net.ResolveTCPAddr("tcp", "119.29.29.29:80")
if err != nil {
@jackyyf
jackyyf / vote.py
Created May 11, 2017 18:48
Gist by paste.py @ 2017-05-12 02:48:45.276199
import requests
import gevent
from gevent import monkey; monkey.patch_all(); del monkey
import random
import time
concurrent = 8
delay = 0.5
def get_user_agent():
@jackyyf
jackyyf / netns-launch
Created October 19, 2016 11:10
Launch tox-bootstrapd inside network namespace.
#!/bin/bash
who am i 1>&2
NSNAME=tox-bootstrapd
## ${VETH_PREFIX}0 is outside, and ${VETH_PREFIX}1 is inside.
VETH_PREFIX=tox
OUT_ADDRS="
A.B.C.125/31
@jackyyf
jackyyf / fix-enemyfleet.go
Created April 5, 2017 23:11
Gist by paste.py @ 2017-04-06 07:11:00.703243
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
@jackyyf
jackyyf / <stdin>
Created March 5, 2017 19:44
Gist by paste.py @ 2017-03-06 03:44:48.350945
Wiphy phy0
max # scan SSIDs: 4
max scan IEs length: 2257 bytes
max # sched scan SSIDs: 0
max # match sets: 0
max # scan plans: 1
max scan plan interval: -1
max scan plan iterations: 0
Retry short limit: 7
Retry long limit: 4