Skip to content

Instantly share code, notes, and snippets.

@crcastle
crcastle / nodejs.sh
Created December 29, 2010 00:39
Node.js tartup script for AWS EC2 Linux box
#!/bin/bash
# nodejs - Startup script for node.js server
# chkconfig: 35 85 15
# description: node is an event-based web server.
# processname: node
# server: /path/to/your/node/file.js
# pidfile: /var/run/nodejs.pid
#
@ajkeeton
ajkeeton / permessage_deflate_issue_poc
Created July 18, 2016 19:56
Permessage-deflate issue with Go's deflate
package main
import (
"compress/flate"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
// "bufio"
"bytes"
@llaumgui
llaumgui / build_repository.sh
Last active July 26, 2016 18:38
Create an YUM reporistory from RPM with createrepo & repoview.
#!/bin/bash
#
# Create an YUM reporistory from RPM with createrepo & repoview
#
# Repository options
REPO_PATH=/home/toto/public_html/rpms.toto.com/www
REPO_LIST="toto toto-testing"
DISTRO_LIST="el fedora"
@lleveque
lleveque / go-complete.sh
Last active December 13, 2016 20:55
When in your $GOPATH, make `go` autocomplete to packages. Add this to your .bashrc.
function _gocomplete_()
{
# What do we want to autocomplete ?
local word=${COMP_WORDS[COMP_CWORD]}
# list packages that match in src/ subfolder, discarding warnings if no result
COMPREPLY=($(go list ./src/"${word}"... 2>/dev/null))
}
# register autocomplete function for `go`
complete -F _gocomplete_ go
@mh-cbon
mh-cbon / main.go
Last active June 7, 2017 07:47
golang, simple stream
package main
import (
"errors"
"fmt"
"io"
"strings"
"sync"
"time"
)
@the8472
the8472 / dht.log
Last active July 4, 2017 17:59
get_peers verbose log
[2017-07-04T16:10:18.324077Z][Verbose] PeerLookupTask 108661049 target:028EA9E1 BA7E9A88 E3955FC8 ABF406A8 60605BCA todo:55 SENT:25 RECEIVED:10 STALLED:0 FAILED:15 SENT_SINCE_RECEIVE:6 activeOnly:0 unanswered:0 srv: D58EDB92 CED1221D 7BEABA36 4BA42651 0E0FEBB3 FINISHED time to finish:PT12.466S name:null
Task 108661049 done SENT:25 RECEIVED:10 STALLED:0 FAILED:15 SENT_SINCE_RECEIVE:6 activeOnly:0 unanswered:0 closestset: 8 tailMod:0 headMod:7 head:22 tail:19
028EA9E1 BA7E9A88 E3955FC8 ABF406A8 60605BCA
028EAB74 919F450D BB0A0A1D 80101CA1 7720F738 00000295 2BE1DF85 589F55D5 2BE41A09 1740ACF2 src:7
028EAC09 ACCFEEEC 12B34420 1122EF79 3F2F4737 000005E8 16B17464 F1261BE8 BAD6E9D1 5F4F1CFD src:6
028EAFF1 F1BBE9EB B3A6DB3C 870C3E99 245E0D90 00000610 4BC57363 503384F4 2CF83831 443E565A src:5
028EAF9C 0F4B7764 3151CE90 0F8EEE4B 70FFC490 0000067D B535EDEC D2C49158 A47AE8E3 109F9F5A src:4
028EA249 F1F1BBE9 EBB3A6DB 3C870C3E 99245E52 00000BA8 4B8F2161 0826F913 97730A96 F9440598 src:4
028EA529 EEAD36A5 41583A3A 3500
@kylelemons
kylelemons / gencert.sh
Created November 17, 2011 02:55
Generate a key/certificate
#!/bin/bash
# Usage: gencert.sh
# Generates SSL certificates
set -e
PREFIX="my_"
function oops() {
echo "Failed."
exit 1
@bserdar
bserdar / gocontracts.md
Last active November 22, 2018 04:12
Types are contracts

v2:

This started as a thought experiment after I read the Go generics and contracts proposal. The original proposal is powerful enough to specify precise type properties from the point of the generic implementor, however constraints such as "type T must support operator <" is over-specific in a language where < cannot be redefined. Such a constraints means "T must be numeric or string". So this exercise is an extension of the idea that contracts should be specified in terms of existing types, not in terms of type capabilities.

@WayneBuckhanan
WayneBuckhanan / Vagrantfile.OSX
Last active July 13, 2019 15:55
OSX Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# https://github.com/AndrewDryga/vagrant-box-osx
config.vm.box = "osx-yosemite"
<dgryski@kamek[powbench] \ʕ◔ϖ◔ʔ/ > go test -test.bench=.
BenchmarkPolyPow-4 5000000 286 ns/op
BenchmarkPolyFast-4 100000000 16.7 ns/op
PASS
ok github.com/dgryski/powbench 3.430s