Skip to content

Instantly share code, notes, and snippets.

@amsz
amsz / ssr.md
Last active July 20, 2017 06:58

SSR

Env

  • Ubuntu 17.04

BBR

sudo apt-get update
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files (x86)\\Microsoft VS Code Insiders\\Code - Insiders.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files (x86)\\Microsoft VS Code Insiders\\Code - Insiders.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@amsz
amsz / LDAP.java
Created June 7, 2017 09:49
LDAP for AD
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.*;
import java.util.Hashtable;
public class TestApp {
public static void main(String[] args) {
Hashtable<String, String> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
#!/bin/bash
# 语法: getopts OPTSTRING VARNAME [ARGS…]
# OPTSTRING 是允许的选项,例如"lt:p:",字母后面紧跟一个冒号":"表示该选项需要参数,例如 -l -p aaa
# VARNAME 是getopts用来存储每次解析到的选项字母(不包括 "-" )
#
# 错误处理
# A. getopts发现错误(非法选项或者选项缺少参数),输出错误信息
# B. 在OPTSTRING前加多一个冒号 ":" (比如 ":lt:p:"),则不会输出错误信息并做如下处理
# B1. 非法选项:VARNAME被设为 "?",OPTARG被设为所解析到非法选项字母
let fs = require('fs')
let cheerio = require('cheerio')
let file = fs.readFileSync('ios_device_specifications_grid.html');
let $ = cheerio.load(file);
var keys = [];
var data = [];
var shouldAddKey = true;
@amsz
amsz / gist:64727a56a10466837b4ca8458813672c
Created May 25, 2016 09:03 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
import os
times = 2
show_top = 10
flag = 'time='
domain = '.vpnhide.com'
protocols = ['p1', 'p2']
nodes = { # node: number
'jp': 4,
$gitlab_server=
# gitlab server
0 2 * * * tar -cf $(date "+/var/opt/gitlab/backups/%s_gitlab_etc.tar") -C / etc/gitlab; /opt/gitlab/bin/gitlab-ci-rake backup:create CRON=1
# backup server
0 3 * * * rsync -avH root@$gitlab_server:/var/opt/gitlab/backups/ ~/Documents/backup/gitlab
@amsz
amsz / ss.sh
Last active September 8, 2015 00:49
翻翻翻
apt–get install python–gevent python–pip python–m2crypto
pip install shadowsocks
mkdir -p /etc/shadowsocks.conf
vi /etc/shadowsocks.conf
```
{
"server": "0.0.0.0",
"port_password":
{
@amsz
amsz / MetricInfo
Created January 26, 2015 07:25
Reflection to get MemoryMeter
public class MetricInfo {
static Object memoryMeter;
static {
try {
memoryMeter = Class.forName("org.github.jamm.MemoryMeter").newInstance();
logger.info("MemoryMeter loaded");
} catch (Exception e) {
// empty
}