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 python3 | |
# -*- coding: utf-8 -*- | |
# Author: David Manouchehri <[email protected]> | |
# This script will always echo back data on the UDP port of your choice. | |
# Useful if you want nmap to report a UDP port as "open" instead of "open|filtered" on a standard scan. | |
# Works with both Python 2 & 3. | |
import socket |
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
func (t *tokenRing) GetIndexForPartitionKey(partitionKey []byte) int { | |
if t == nil { | |
return 0 | |
} | |
hash := t.partitioner.Hash(partitionKey) | |
l := len(t.tokens) | |
// no host tokens, no available hosts | |
if l == 0 { | |
return 0 |
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
function initWIFI() | |
print("Setting up WIFI...") | |
wifi.setmode(wifi.STATION) | |
wifi.sta.config("<wifi-id>", "<wifi-password>") | |
wifi.sta.connect() | |
tmr.alarm(1, 1000, 1, | |
function() | |
if wifi.sta.getip()== nil then | |
print("IP unavailable, Waiting...") |
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
from PIL import Image | |
import requests | |
from IPython.display import Image as DisplayImage | |
import io | |
def get_im_by_url(url): | |
r = requests.get(url) | |
return Image.open(io.BytesIO(r.content)) | |
def display(im): |
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
(set-frame-font "Monaco-12") | |
(set-fontset-font "fontset-default" 'han '("Hiragino Sans GB W3" . "unicode-bmp")) | |
(defun set-font (english chinese english-size chinese-size) | |
(set-face-attribute 'default nil :font | |
(format "%s:pixelsize=%d" english english-size)) | |
(dolist (charset '(kana han symbol cjk-misc bopomofo)) | |
(set-fontset-font (frame-parameter nil 'font) charset | |
(font-spec :family chinese :size chinese-size)))) | |
(set-font "Monaco" "Hiragino Sans GB W3" 12 14) |
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
./configure --prefix=/opt/openresty \ | |
--with-debug \ | |
--with-http_iconv_module \ | |
--with-http_postgres_module \ | |
--with-luajit \ | |
--with-http_realip_module \ | |
--with-http_image_filter_module \ | |
--with-http_geoip_module \ | |
--with-http_gzip_static_module \ | |
--with-http_stub_status_module \ |
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 | |
# coding=utf8 | |
import sys | |
import time | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
def timeit(method): |
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
local cjson = require('cjson') | |
local util = require('login_util') | |
if ngx.var.request_method ~= 'POST' then | |
ngx.log(ngx.WARN, 'request method is not post') | |
ngx.exit(400) | |
end | |
ngx.req.read_body() | |
local args = ngx.req.get_post_args() |
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 | |
sudo modprobe ip_queue | |
sudo iptables -I OUTPUT -p tcp --sport 8080 -j QUEUE | |
sudo iptables -I OUTPUT -d 192.168.98.0/24 -j ACCEPT | |
sudo intercept | |
sudo iptables -F OUTPUT |
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 my calepin style | |
// @namespace | |
// @description fix max-width of <p> and font-size of code block | |
// @include http://chaos.calepin.co/* | |
// @require http://code.jquery.com/jquery-1.6.2.min.js | |
// ==/UserScript== | |
$("article p, article ol, article li").css("max-width", "748px"); | |
$(".codehilite *, .gist *").css("font-size", "9pt"); |
NewerOlder