Skip to content

Instantly share code, notes, and snippets.

View StarDuster's full-sized avatar
🗾
Working from home

Jun Liu StarDuster

🗾
Working from home
View GitHub Profile
#!/bin/bash
function load_var {
eval $(cat ${1} <( echo -e '\nset -o posix;set\n') | env - bash --noprofile --norc --posix | sed 's/^/'$2'_/')
if [ -n "$IF_IPSEC6" ]; then
PEER_ENDPOINT=$PEER_ENDPOINT6
SELF_ENDPOINT=$SELF_ENDPOINT6
fi
}
#!/bin/bash
function gen {
dd if=/dev/urandom 2>/dev/null | tr -dc a-f0-9 | fold -w $1 | head -n 1 | sed 's/^/0x/'
}
spi=`gen 8`
reqid=`gen 8`
auth_key=`gen 64`
enc_key=`gen 64`
@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
@davidjb
davidjb / recovery.sh
Created December 21, 2016 08:21
Create macOS Sierra Recovery Partition Without Reinstalling
TARGET="/Volumes/Macintosh HD" # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install\ macOS\ Sierra.app" # Path to your macOS installer
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg
hdiutil mount ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate
@ole1986
ole1986 / traffic-control.sh
Last active May 14, 2024 11:08
Traffic control script for incoming and outgoing packages using TC (on a specific ip address)
#!/bin/bash
VERSION="1.0.2"
# Interface connect to out lan
INTERFACE="eth0"
# Interface virtual for incomming traffic
VIRTUAL="ifb0"
# set the direction (1 = outgoing only, 2 = incoming only 3 = both)
DIRECTION=3
# Speed
@typcn
typcn / run.js
Last active February 1, 2017 18:36
umetrip_auto_sign
const tpush = require('typcnpush-sdk');
const http = require('http');
tpush.useInternalMode();
setInterval(function(){
let options = {
host: 'ume1.umetrip.com',
port: 80,
path: '/UmeAd/everyday/luck.do?sid=YOUR_SESSION_ID',
method: 'GET'
#!/usr/bin/python
# Credit to frogor for the objc
from Foundation import NSBundle
import json
import objc
import os
import plistlib
import subprocess
@typcn
typcn / gist:0b10dbb140faa296cabc988ac80f718e
Last active April 29, 2018 09:06
Fix macOS ping spike ( openwrt / lede )
Don't use 2.4Ghz
list ht_capab 'SHORT-GI-40'
list ht_capab 'DSSS_CCK-40'
list ht_capab 'TX-STBC'
list ht_capab 'RX-STBC1'
option frag '2304'
option rts '2304'
option beacon_int '75'
@pandada8
pandada8 / dumpfolder.py
Last active March 6, 2021 00:43
dumpfolder
import requests
from requests_html import HTMLSession
import os
import sys
import urllib
from xmlrpc.client import ServerProxy
session = HTMLSession()
@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