Skip to content

Instantly share code, notes, and snippets.

View kevinzhow's full-sized avatar
🏠
正在搬砖

Kevin kevinzhow

🏠
正在搬砖
View GitHub Profile
@kevinzhow
kevinzhow / vpnup.sh
Created September 28, 2013 04:14
DDWRT 指定国内IP路由脚本
#!/bin/sh
set -x
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"
LOG='/tmp/autoddvpn.log'
LOCK='/tmp/autoddvpn.lock'
PID=$$
EXROUTEDIR='/jffs/exroute.d'
INFO="[INFO#${PID}]"
@kevinzhow
kevinzhow / bootstrap_rails_development_server.sh
Last active August 29, 2015 13:57
Bootstrap_Rails_Development
#!/usr/bin/env bash
# Pre-requisites
# Add Node.js PPA
sudo add-apt-repository ppa:chris-lea/node.js -y
# # Install Mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 -y
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
@kevinzhow
kevinzhow / ocserv
Created March 20, 2014 11:15
ocserv 启动脚本
#!/bin/sh
### BEGIN INIT INFO
# Provides: ocserv
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# Copyright Rene Mayrhofer, Gibraltar, 1999
# This script is distibuted under the GPL
@kevinzhow
kevinzhow / route.sh
Last active October 2, 2022 08:01
AnyConnect 路由表
route = 8.0.0.0/255.0.0.0
route = 58.0.0.0/255.0.0.0
route = 23.0.0.0/255.0.0.0
route = 117.0.0.0/255.0.0.0
route = 199.0.0.0/255.0.0.0
route = 190.0.0.0/255.0.0.0
route = 198.0.0.0/255.0.0.0
route = 173.0.0.0/255.0.0.0
route = 174.0.0.0/255.0.0.0
route = 168.0.0.0/255.0.0.0
@kevinzhow
kevinzhow / ip_cook.rb
Created March 20, 2014 11:24
路由转换
#utf-8
require 'netaddr'
newfile = File.open("some_file", "w")
File.foreach('out_ip').with_index { |line, line_num|
line = line.split(',')[0].to_s
a = NetAddr::CIDR.create(line)
puts "#{a.ip}/#{a.wildcard_mask}"
newfile.write("route = #{a.ip}/#{a.wildcard_mask}\n")
@kevinzhow
kevinzhow / bootstrap_pushbird.sh
Last active August 29, 2015 14:00
bootstrap_pushbird
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get install software-properties-common -y
# Add Node.js PPA
sudo add-apt-repository ppa:chris-lea/node.js -y
00000000 ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 01 JFIF
00000010 00 01 00 00 ff db 00 84 00 03 02 02 03 02 02 03
00000020 03 03 03 04 03 03 04 05 08 05 05 04 04 05 0a 07
00000030 07 06 08 0c 0a 0c 0c 0b 0a 0b 0b 0d 0e 12 10 0d
00000040 0e 11 0e 0b 0b 10 16 10 11 13 14 15 15 15 0c 0f
00000050 17 18 16 14 18 12 14 15 14 01 03 04 04 05 04 05
00000060 09 05 05 09 14 0d 0b 0d 14 14 14 14 14 14 14 14
00000070 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
00000080 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
00000090 14 14 14 14 14 14 14 14 14 14 ff c0 00 11 08 03
recursive_route_convert = (_value, _key = '/', _stack = ['/'], _strict=false) ->
return _.flatten(_.map(_value, (__value, __key) ->
__stack = _.clone(_stack)
__stack.push(__key)
if _.isFunction(__value)
http_verb = __stack.splice(__stack.length - 2, 1)[0].toLowerCase()
if http_verb not in ['options','get','head','post','put','delete','trace','connect','patch']
throw(new Error("#{http_verb} is not in the HTTP Methods white list"))
else
strict_url = __stack.join('/').replace(/\/+/g,'/')
@kevinzhow
kevinzhow / gist:984f55af8b6c901814b1
Last active September 17, 2016 10:32
iptables_ipsec_pptp.rules
#!/bin/sh
# Flush old rules, old custom tables
/sbin/iptables --flush
/sbin/iptables --flush -t nat
/sbin/iptables --delete-chain
# Set default policies for all three default chains
/sbin/iptables -P INPUT DROP
/sbin/iptables -P FORWARD DROP
@kevinzhow
kevinzhow / VerticalLayout.swift
Created March 7, 2015 06:41
VerticalLayout
//
// DiaryVerticalTextView.swift
// Diary
//
// Created by kevinzhow on 15/3/6.
// Copyright (c) 2015年 kevinzhow. All rights reserved.
//
import UIKit
import CoreText