Skip to content

Instantly share code, notes, and snippets.

View vvtommy's full-sized avatar
🏠
Working from home

vvtommy

🏠
Working from home
View GitHub Profile
@dirkk0
dirkk0 / gist:2275361
Created April 1, 2012 13:39
Install Browserquest on Amazon EC2
# see http://web3dblog.wordpress.com/2012/03/30/installing-browserquest-on-amazon-ec2/
apt-get update
apt-get upgrade
apt-get install --yes build-essential g++ libssl-dev curl git-core
apt-get install --yes libxml2-dev libssl0.9.8
export NODE_VERSION='0.6.8'
wget http://nodejs.org/dist/node-v$NODE_VERSION.tar.gz
@greensea
greensea / OpenVPN-2.2.2-obfs.patch
Last active March 22, 2023 09:17
The obfs patch obsfucate OpenVPN traffic, make it looks like random traffic. The obfs patch add two options for OpenVPN. --obfs-salt <string> is a secret to generate the input XOR stream. To enable the obfs patch, this options must be set. --obfs-padlen <num> is a positive integer max to 255. This option tells obfs patch to padding random conten…
--- openvpn-2.2.2.orig/options.c 2011-12-14 00:58:56.000000000 +0800
+++ openvpn-2.2.2/options.c 2012-12-21 10:44:57.683130505 +0800
@@ -54,6 +54,10 @@
#include "memdbg.h"
+extern char* _socket_obfs_salt;
+extern int _socket_obfs_salt_len;
+extern int _socket_obfs_padlen;
+
@JacksonTian
JacksonTian / uselesscode.md
Last active December 13, 2015 22:19
Node代码中最常见的几种废代码

三元表达式

var foo = bar === 'xxx' ? true : false;
// 更好的代码是:
var foo = bar === 'xxx';

两个和三个等号的判断,都是得到布尔值。

回调函数的传递

--- src/openvpn/options.c.orig 2012-12-17 17:36:07.000000000 +0800
+++ src/openvpn/options.c 2013-03-07 23:21:26.230153027 +0800
@@ -62,6 +62,10 @@
#include "memdbg.h"
+extern char* _socket_obfs_salt;
+extern int _socket_obfs_salt_len;
+extern int _socket_obfs_padlen;
+
@antonellopasella
antonellopasella / Applescript to send new iMessage
Last active February 20, 2019 19:09
How to send a new iMessage throug Applescript. For retrieve the contactname select your contact from list then SHIFT+CMD+I
tell application "Messages"
set isAppRunning to false
tell application "System Events"
if (exists process "Messages") then
set isAppRunning to true
end if
end tell
if isAppRunning is false then
@trawor
trawor / gist:5843485
Created June 23, 2013 02:27
获取国内手机号运营商
/** 获取国内手机号运营商
* @param phone 手机号
* @return `U`是联通,`M`是移动,`T`是电信
*/
+(NSString*)carrierOfPhone:(NSString*)phone{
if (phone.length>11) {
//去掉乱七八糟的字符
phone=[[phone componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"+- "]] componentsJoinedByString:@""];
//如果86开头 去掉
@edokeh
edokeh / index.js
Last active May 3, 2024 08:18
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@janlay
janlay / README.md
Last active March 4, 2024 05:25
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt Or run $ sh build-all to build all your index files.
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

@mkrcah
mkrcah / gist:ffc05e0cfa59fe206d13
Created November 20, 2015 18:21
Install google fonts on Ubuntu, usable by PhantomJS
# Install google fonts
git clone https://github.com/google/fonts.git
sudo mkdir -p /usr/share/fonts/truetype/google-fonts/
find fonts/ -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/google-fonts/ \;
sudo apt-get install fontconfig -y
sudo fc-cache -fv
@mr-pinzhang
mr-pinzhang / Xcode 文件下载.md
Last active August 22, 2023 04:24
Xcode 文件下载

在 Xcode 里下载文件真的是一种折磨, 特别是每次 Xcode 大版本更新都会遇到新的下载内容. 经过一翻周折, 本人找到一个方法可以轻松快速便捷地下载和安装对应的 Simulator 和 Doc 文件

  1. 在 Mac 下, 打开 Xcode, 进入 Preference 中的 Downloads 面板
  2. 点击任意的下载按钮
  3. 打开系统帮助工具 Console
  4. 稍等一会儿, 在 Xcode 里取消下载, 然后你会在 Console 里面看到对应的下载地址 (对应的 Cosnole Message 是 (DVTDownloadable: Download Cancelled. Downloadable: ...) 之类的)
  5. 复制对应的链接地址, 到某雷或者任何比 Xcode 下载快的工具里
  6. 等待下载完成, 进入 /Users/#{Username}/Library/Caches