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 plyvel | |
import sys | |
import collections | |
db = plyvel.DB(sys.argv[1]) | |
tab = { | |
b"00": "DBUser", |
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 bash | |
# You just ran `git merge origin/master`. But what happened? | |
# Shows the diff between | |
# - your changes from old master before merging | |
# - your changes from NEW master AFTER merging | |
COMMON_ANCESTOR=$(git merge-base $(git show -s --pretty=%P HEAD)) | |
git d $COMMON_ANCESTOR..HEAD^1 > /tmp/diff1.txt | |
git d HEAD^2..HEAD > /tmp/diff2.txt | |
kdiff3 /tmp/diff{1,2}.txt |
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
{make_esc} = require "iced-error" | |
bounce = (f) -> | |
setTimeout f, 0 | |
f = ({ok}, cb) -> | |
bounce -> | |
console.log "f #{ok}" | |
if ok | |
cb null |
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
package main | |
import ( | |
"fmt" | |
) | |
func f() (int, int) { | |
return 3, 4 | |
} |
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
// https://play.golang.org/p/ZVV6drJRqva | |
package main | |
import ( | |
"fmt" | |
) | |
type S struct { | |
i int64 | |
} |
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
# Add this to ~/.gitconfig | |
[alias] | |
# Force push this branch, but with a confirmation. | |
force = !~/bin/git-force-push-ask |
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
func Signalsnoop() { | |
ch := make(chan os.Signal, 500) | |
go func() { | |
for { | |
s := <-ch | |
fmt.Printf("SIGNAL: %+v\n", s) | |
} | |
}() | |
signal.Notify(ch) | |
} |
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
/* | |
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
* | |
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
* | |
* This file contains Original Code and/or Modifications of Original Code | |
* as defined in and that are subject to the Apple Public Source License | |
* Version 2.0 (the 'License'). You may not use this file except in | |
* compliance with the License. The rights granted to you under the License | |
* may not be used to create, or enable the creation or redistribution of, |
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
/* | |
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
* | |
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
* | |
* This file contains Original Code and/or Modifications of Original Code | |
* as defined in and that are subject to the Apple Public Source License | |
* Version 2.0 (the 'License'). You may not use this file except in | |
* compliance with the License. The rights granted to you under the License | |
* may not be used to create, or enable the creation or redistribution of, |
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
# Puzzle solution | |
# Using the numbers [1, 3, 4, 6] and operations [+, -, *, /], | |
# find an expression that equals 24. | |
# Use each number exactly once. | |
# The puzzle is fun! Don't read this until you've solved it. | |
# Uses amb, the (super cool) ambiguity operator. (Explained below) | |
# Print in continuation passing style. | |
# A continuation (k) is basically a word a callback. | |
# It's the function that represents what to do next. |
NewerOlder