This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Attribution: https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server | |
try: | |
# Python 3 | |
from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig | |
import sys | |
def test (*args): | |
test_orig(*args, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## calculating moving average | |
## x: data vector | |
## n: use how many samples | |
## s: 1 - with lag; 2 - symmetrically | |
f.ma <- function(x,n=5,s=2){filter(x,rep(1/n,n), sides=s)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'linode' | |
api_key = '<API_KEY_STRING>' | |
domain_id = 123456 # Domain ID | |
resource_id = 7654321 # Resource ID | |
new_ip = `ifconfig | grep "inet " | grep -v '127.0.0'`.split(' ')[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name zhihu - 快捷话题绑定 | |
// @namespace http://www.zhihu.com/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://www.zhihu.com/question/* | |
// @copyright 2012+, You | |
// ==/UserScript== | |
var topics = [[220,'知乎社区'],[33917,'个人咨询'],[87436,'成人内容'],[1309,'调查类问题']]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
parse_and_echo() { | |
echo "\$1:$1 \$2:$2 \$3:$3 \$4:$4" | |
echo newline | |
} | |
export -f parse_and_echo | |
# `_' is placeholder for $0 |
OlderNewer