Skip to content

Instantly share code, notes, and snippets.

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

Kevin kevinzhow

🏠
正在搬砖
View GitHub Profile
@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 / 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 / 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
@kevinzhow
kevinzhow / skill.swift
Last active November 28, 2015 13:08
CoreGraphic Draw
func genSkillImageWithSkills(skills: [Skill]) -> UIImage {
let maxWidth:CGFloat = 170
let marginTop:CGFloat = 3.0
let marginLeft: CGFloat = 6.0
let lineSpacing: CGFloat = 5.0
#!/bin/bash
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"
OLDGW=`cat /tmp/vpn_oldgw`
route del -net 1.0.1.0 netmask 255.255.255.0
route del -net 1.0.2.0 netmask 255.255.254.0
route del -net 1.0.8.0 netmask 255.255.248.0
route del -net 1.0.32.0 netmask 255.255.224.0
@kevinzhow
kevinzhow / MainView.ux
Created December 20, 2015 08:21
Fuse ScrollView
<App Theme="Basic">
<JavaScript File="main.js" />
<ScrollView Padding="30" ScrollPositionChanged="{Say}">
<StackPanel ItemSpacing="20">
<Each Items="{people}">
<Rectangle>
<Stroke Width="2" Brush="#000" />
<StackPanel ItemSpacing="5" Margin="10">
<Text Value="{name}" FontSize="20" TextColor="#000" Margin="0"/>
<Text Value="{age}" TextColor="#aaa"/>
@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}]"
#/bin/bash
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"
OLDGW=192.168.0.1
route add -net 1.0.1.0 netmask 255.255.255.0 gw $OLDGW
route add -net 1.0.2.0 netmask 255.255.254.0 gw $OLDGW
route add -net 1.0.8.0 netmask 255.255.248.0 gw $OLDGW
route add -net 1.0.32.0 netmask 255.255.224.0 gw $OLDGW
route add -net 1.1.0.0 netmask 255.255.255.0 gw $OLDGW