Skip to content

Instantly share code, notes, and snippets.

View c4milo's full-sized avatar
:octocat:

Camilo Aguilar c4milo

:octocat:
View GitHub Profile
@paulirish
paulirish / args.gn
Last active October 22, 2023 12:25
How to build Chromium to hack on DevTools
# 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
@jakejscott
jakejscott / server.go
Created May 20, 2014 00:53
negroni + httprouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
@c4milo
c4milo / ejabberd.conf
Created May 18, 2014 18:47
Upstart script for Ejabberd
# 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
package main
import (
"fmt"
"math/rand"
"strconv"
"time"
"github.com/octplane/mnemo"
)

Consul Consistency

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.

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
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
@creationix
creationix / convert.js
Last active March 31, 2020 07:15
Convert a hex string (base-16) to a base-65536 (16-bit) string.
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;
}
@manishtpatel
manishtpatel / main.go
Last active October 18, 2023 03:12
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@jvns
jvns / interview-questions.md
Last active April 25, 2024 15:52
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {