Skip to content

Instantly share code, notes, and snippets.

View icyleaf's full-sized avatar
🍺
Diving into beer

icyleaf icyleaf

🍺
Diving into beer
View GitHub Profile

icyleaf's atom settings, automatic update by sync-settings

@icyleaf
icyleaf / tmux-cheatsheet.markdown
Created May 26, 2016 04:12 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@icyleaf
icyleaf / surge_main.conf
Created May 12, 2016 07:27 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0
#!/bin/sh
# create self-signed server certificate:
# source: https://github.com/michaelliao/itranswarp.js/blob/master/conf/ssl/gencert.sh
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 1024

PS4 网络环境优化

0 案例环境

  • 中国电信 100M 宽带接入,局域网段 192.168.1/24,光猫拥有管理员权限(后继需要);
  • NetGear WNDR3700v2 跑 OpenWRT 作为家庭主路由器, WAN IP 192.168.1.234,局域网段 10.10.10/24
  • PS4 无线连家庭网络(主),IP 10.10.10.3;有线连光猫(备),IP 192.168.1.3
#!/usr/bin/env ruby
require 'plist'
require 'rest_client'
def try_pass(apple_id, password)
url = "https://fmipmobile.icloud.com/fmipservice/device/#{apple_id}/initClient"
basicOauth = Base64.encode64("#{apple_id}:#{password}")
headers = {
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
000A6E5618E024720032B816 /* discount_time.png in Resources */ = {isa = PBXBuildFile; fileRef = 000A6E5218E024720032B816 /* discount_time.png */; };
@icyleaf
icyleaf / ar_migrate.rb
Last active October 13, 2023 03:21
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default
@icyleaf
icyleaf / json_to_opml.rb
Created December 16, 2013 06:44
Google Reader "subscriptions.json" file to opml: ruby json_to_opml.rb /to/your/subscriptions.json > /to/your/saved/path
require 'multi_json'
require 'builder'
data = File.new(ARGF[0])
json = MultiJson.load(data)
feeds = {}
json["subscriptions"].each do | item |
item["categories"].each do |cat|
cat_name = cat["label"]
@icyleaf
icyleaf / .vimrc
Last active March 3, 2016 09:12
vim config (Mac OS + vim + vundle)
" Vim Config
" Source: http://www.integralist.co.uk/posts/vim-workflow-part-deux/
" switch syntax highlighting on, when the terminal has colors
syntax on
" use vim, not vi api
set nocompatible
" no backup files