Skip to content

Instantly share code, notes, and snippets.

View sean-lin's full-sized avatar

Sean Lin sean-lin

View GitHub Profile
#!/usr/bin/bash
docker ps |awk '{if(NR>1) print $1}' | xargs -n 1 docker inspect -f '{{ .Name }} {{ .NetworkSettings.IPAddress }}'
@sean-lin
sean-lin / click.py
Last active August 10, 2016 04:42
python windows auto click
# -*- coding: utf-8 -*-
import time
import win32con
import win32api
import ctypes
from ctypes import wintypes
byref = ctypes.byref
user32 = ctypes.windll.user32
@sean-lin
sean-lin / killop.js
Created August 16, 2016 03:54
a script to kill query ops starting with a namespace from mongo database
killLongRunningOps = function(startswith) {
currOp = db.currentOp();
currOp.inprog.forEach(function(op) {
if (op.op == "query" && op.ns.startsWith(startswith)) {
print("Killing opId: " + op.opid + " running over for secs: " + op.secs_running);
db.killOp(op.opid);
}
});
};
@sean-lin
sean-lin / prd.py
Last active January 17, 2017 04:09
import random
TEST_N = 10000000
def calc(target):
rate_max = 1
rate_min = 0
while True:
rate = dt = (rate_max + rate_min)/2.0
@sean-lin
sean-lin / build.sh
Last active July 12, 2017 08:09
xcode build framework
# Sets the target folders and the finalframework product.
# 如果工程名称和Framework的Target名称不一样的话,要自定义FMKNAME
# 例如: FMK_NAME = "MyFramework"
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output tothe framework.
# The following line create it in the rootfolder of the current project.
INSTALL_DIR=${SRCROOT}/../Products/${FMK_NAME}.framework
# Working dir will be deleted after theframework creation.