As Kyle brought up, Consul at the moment has a single known case of a potential inconsistency (Could be unknown cases lurking). Currently Consul works by electing a leader, who "leases" the position for LeaderLeaseTimeout interval. At each interval, it checks that a quorum of nodes still believes it to be the leader. At the same time, if a follower does not hear from the leader within randomInterva(HeartbeatTimeout, 2 * HeartbeatTimeout), it will start a new election.
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 hexToBase65536(hex) { | |
var result = ""; | |
for (var i = hex.length ; i > 0; i -= 4) { | |
result += String.fromCharCode(parseInt(hex.substring(i - 4, i), 16)); | |
} | |
return result; | |
} |
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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strconv" | |
"time" | |
"github.com/octplane/mnemo" | |
) |
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
# Ubuntu upstart file at /etc/init/ejabberd.conf | |
respawn | |
respawn limit 20 5 | |
start on runlevel [2345] | |
stop on runlevel [06] | |
script | |
exec start-stop-daemon --start --name ejabberd --user ejabberd --chuid ejabberd --exec /usr/local/sbin/ejabberdctl -- start |
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
package main | |
import ( | |
"fmt" | |
"github.com/codegangsta/negroni" | |
"github.com/julienschmidt/httprouter" | |
"net/http" | |
) | |
func main() { |
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
# Build arguments for the gn build | |
# You can set these with `gn args out/Default` | |
# ( and they're stored in src/out/Default/args.gn ) | |
# See "gn args out/Default --list" for available build arguments | |
# component build, because people love it | |
is_component_build = true | |
# release build, because its faster | |
is_debug = true |
... any takers? Comment on this gist! The discussion all started from a Tweet:
Who's going to be the first to write a wrapper for the @thalmic #myo C++ library? Latest headers: https://gist.github.com/indexzero/60d1224f0082f0d16f14
As pointed out by @c4milo there are a number of libraries that exist, but from first glance they all have deficiencies:
- https://github.com/HektorW/myo-node: Only works on Windows
- https://github.com/KamalAman/Myo-Node-Red: I don't even understand how this works
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
BenchmarkBoltStore_FirstIndex-5 1000000 1932 ns/op | |
BenchmarkBoltStore_LastIndex-5 1000000 1907 ns/op | |
BenchmarkBoltStore_GetLog-5 300000 5931 ns/op | |
BenchmarkBoltStore_StoreLog-5 5000 266819 ns/op | |
BenchmarkBoltStore_StoreLogs-5 5000 300801 ns/op | |
BenchmarkBoltStore_DeleteRange-5 5000 322467 ns/op | |
BenchmarkBoltStore_Set-5 10000 247162 ns/op | |
BenchmarkBoltStore_Get-5 1000000 2176 ns/op | |
BenchmarkBoltStore_SetUint64-5 10000 240333 ns/op | |
BenchmarkBoltStore_GetUint64-5 1000000 2209 ns/op |
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
/////////////////////////////////////////////////////////////// | |
// Aho-Corasick's algorithm, as explained in // | |
// http://dx.doi.org/10.1145/360825.360855 // | |
/////////////////////////////////////////////////////////////// | |
// Max number of states in the matching machine. | |
// Should be equal to the sum of the length of all keywords. | |
const int MAXS = 6 * 50 + 10; | |
// Number of characters in the alphabet. |