Skip to content

Instantly share code, notes, and snippets.

View nbari's full-sized avatar
🪴

nbari

🪴
View GitHub Profile
@nbari
nbari / dynamic.go
Last active August 27, 2015 12:41
dynamic map
package my_package
import (
"fmt"
"errors"
"regexp"
"strings"
)
type dynamicSet map[string]regexp.Regexp
@nbari
nbari / run qmail-smtpd-SSL-465
Last active August 29, 2015 13:59
qmail-smtpd-SSL-465
#!/bin/sh
exec 2>&1
#
# SMTP service
#
QMAIL="/var/qmail"
ME="`head -1 $QMAIL/control/me`"
CONCURRENCY=${CONCURRENCY:=50}
QUSER="qmaild"
@nbari
nbari / run qmail-smtpd-TLS-587
Created April 12, 2014 18:01
qmail-smtpd-TLS-587
#!/bin/sh
exec 2>&1
#
# SMTP service
#
QMAIL="/var/qmail"
ME="`head -1 $QMAIL/control/me`"
CONCURRENCY=${CONCURRENCY:=50}
QUSER="qmaild"
@nbari
nbari / recetas.py
Last active August 29, 2015 14:01
recetas
import os
from bs4 import BeautifulSoup
from twisted.internet import reactor
from twisted.web.client import getPage
site = 'http://www.1080recetas.com'
def crawl(url):
@nbari
nbari / gist:20a2c681781a0036f5af
Last active August 29, 2015 14:13
walk directory (Walk does not follow symbolic links)
package main
import (
"flag"
"fmt"
"os"
@nbari
nbari / riak 2.0.5
Last active August 29, 2015 14:16
riak 2.0.5 FreeBSD
# $FreeBSD: head/databases/riak/Makefile 371981 2014-11-01 00:09:15Z bapt $
PORTNAME= riak
PORTVERSION= 2.0.5
CATEGORIES= databases
MASTER_SITES= http://s3.amazonaws.com/downloads.basho.com/riak/${PORTVERSION:R}/${PORTVERSION}/ \
http://downloads.basho.com.s3.amazonaws.com/riak/${PORTVERSION:R}/${PORTVERSION}/
MAINTAINER= robak@FreeBSD.org
COMMENT= Riak is an open source, distributed, noSQL database
--- deps/erlang_js/c_src/patches/js-src-config-FreeBSD.mk.patch.orig 2015-02-26 16:11:58 UTC
+++ deps/erlang_js/c_src/patches/js-src-config-FreeBSD.mk.patch
@@ -1,6 +1,6 @@
--- c_src.orig/js/src/config/FreeBSD.mk 1969-12-31 19:00:00.000000000 -0500
+++ c_src/js/src/config/FreeBSD.mk 2011-03-30 20:12:51.000000000 -0400
-@@ -0,0 +1,99 @@
+@@ -0,0 +1,100 @@
+# -*- Mode: makefile -*-
+#
+# ***** BEGIN LICENSE BLOCK *****
@nbari
nbari / gist:9f4666ad51565a03e260
Last active August 29, 2015 14:20
insert sort + unique
//Create some data for testing using:
// jot -s, -r 10000000 1 256 > data
//Test using:
// cat data | ./sort
package main
import (
"bufio"
"fmt"

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@nbari
nbari / panic.go
Last active September 14, 2015 10:05
recover from panic within Goroutines
// The 'recovery' part of a panic has to happen on the same goroutine as the
// panic itself, otherwise it bubbles to the top without being captured. so it
// needed to be "attached" to the same thing that called foo, which was your
// anonymous func the recovery itself is a deferred anonymous func and if it
// feels difficult to use, then that's excellent. you shouldn't be using this,
// and should avoid code that does 'neat' things in this direction
package main
import "fmt"