View charlist.ex
This file contains 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
to_charlist "hello world" |
View read-kinesis.py
This file contains 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 | |
import sys | |
import boto3 | |
import json | |
from datetime import datetime | |
import time | |
if len(sys.argv) != 3: | |
print "Usage: read-kinesis.py <region name> <stream name>" | |
exit(1) |
View migrate-redis.py
This file contains 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
""" | |
Copies all keys from the source Redis host to the destination Redis host. | |
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are | |
restricted (e.g. on Amazon ElastiCache). | |
The script scans through the keyspace of the given database number and uses | |
a pipeline of DUMP and RESTORE commands to migrate the keys. | |
Requires Redis 2.8.0 or higher. |
View proto.js
This file contains 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
var assert = require('assert') | |
var util = require('util') | |
function test (inherits) { | |
function Fruit () { | |
} | |
Fruit.prototype.round = false | |
Fruit.prototype.sweet = true | |
Fruit.prototype.eat = function () {} |
View close.html
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> | |
</head> | |
<body> | |
<script> | |
setTimeout(function () { |
View to-json-array.sh
This file contains 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
ls | jq -R -s -c 'split("\n")' |
View dedupe.sh
This file contains 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
ls | xargs -I{} bash -c 'mv {} $(md5 -q {})' |
View client.html
This file contains 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
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.2/socket.io.js"></script> | |
<script> | |
var socket = io('http://localhost:8088'); | |
var route = createRouter((reply) => { | |
socket.on('rep', reply) | |
}) | |
socket.emit('req', route('hello world', (data) => { | |
console.log(data) | |
})) |
View migrate-plugin.sh
This file contains 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
plugins=$(find . -type d -d 1 | tail -n +3) | |
for plugin in $plugins; do | |
echo plugin: $plugin | |
cd $plugin | |
repo=$(git remote -v | head -n 1 | cut -f 2 | cut -f 1 -d ' ') | |
echo repo: $repo | |
cd .. | |
git submodule add $repo | |
done |
View gen-jsonschema
This file contains 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 | |
# npm install -g yamljs json-schema-generator | |
# json-pretty came from [here](https://gist.github.com/CatTail/fc172a7fe6f300528665e279592c6500) | |
cat "${1:-/dev/stdin}" | json-pretty | json-schema-generator | tail -n +2 | json2yaml -d 10 - |
NewerOlder