Skip to content

Instantly share code, notes, and snippets.

View andreis's full-sized avatar

andreis

View GitHub Profile
@pkieltyka
pkieltyka / gist:76a59d33492dd2732e691ad8c0b274a4
Last active January 3, 2017 22:25
github.com/pressly/chi v2 benchmark suite - using latest versions of each project as of Aug 1, 2016
$ go test -v -bench="Chi|HttpRouter|Goji|Martini|Gorilla|Gocraft|Beego|Gin" .
#GithubAPI Routes: 203
Beego: 165304 Bytes
Chi: 74056 Bytes
Gin: 52464 Bytes
GocraftWeb: 95720 Bytes
Goji: 86088 Bytes
GorillaMux: 1494864 Bytes
HttpRouter: 37464 Bytes
Martini: 556160 Bytes
// @flow
function getOptions() {
return { num: 42, str: "val" };
// ^ Type of this return is inferred without type annotation.
}
/*::
// ^ Comments like this are part of Flow's Comment Syntax.
// They allow you to include any additional syntax and Flow will parse it
#!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import os
import sys
parser = OptionParser()
parser.add_option("-i", "--import", dest="imports", action="append", default=[],
@yangyuqian
yangyuqian / graceful_exit.go
Created March 10, 2017 02:08
Graceful Exit in Go Program
/*
* Killing a program immediately sometimes leads to corrupted data or files, which brings unexpected result in your system.
* In Go, you can catch the termination signals and let your program decide the time of exiting.
*/
package main
import (
"os"
"os/signal"
"syscall"
@campoy
campoy / settings.json
Created July 24, 2017 21:11
My vscode settings
{
"window.zoomLevel": 0,
"go.lintOnSave": "package",
"editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": false,
"workbench.iconTheme": "vs-seti",
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": true,
@i-e-b
i-e-b / _1scatter.cs
Last active August 29, 2017 15:36
Sequence masks and code for old Hypercard fade
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Scramble_test {
public class Scrambler {
UInt32 mask = 0;
UInt32 value = 1;
@lattera
lattera / Article.md
Last active January 22, 2018 16:18
Laptop Review: Purism 15 2K

I received my Purism Librem 15 2K a little less than a week ago. I've been punishing it the last few days, trying to make the most out of it. Even while writing this article, I'm syncing my BitCoin wallet while building Suricata in a bhyve instance.

I bought the 2K version of the Purism Librem 15. Purism was clearing out old stock. I had enough BitCoin to be able to buy the Librem 15 2K fully in BitCoin.

Previous Laptop

My previous laptop was a Lenovo Y50-70 with 16GB RAM. I bought it two years ago to have a dedicated laptop on which to develop HardenedBSD. Around a month later, I switched employers and ended up using my personal laptop for HardenedBSD development, personal use, and work. That laptop has been through hell and back. The back plate is missing multiple screws and the fan is slowly going out. It was a great laptop, with a quadcore Haswell Intel CPU. Speedy and powerful. I'm about to go back to school, so now that I have the Purism Librem 15, I've put

version: '2'
services:
roach-ui:
image: cockroachdb/cockroach:beta-20161215
command: start --insecure
ports:
- 8080:8080
networks:
- roachnet
@blainerothrock
blainerothrock / gen.swift
Last active July 12, 2018 15:56
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
@mreiferson
mreiferson / gist:4039222
Created November 8, 2012 14:48
Example NSQ reader in Go - simplified nsq_to_http
const (
ModeAll = iota
ModeRoundRobin
)
type Publisher interface {
Publish(string, []byte) error
}
type PublishHandler struct {