Skip to content

Instantly share code, notes, and snippets.

Find recursively in all go files

find ~/Projects/ -name "*.go"|xargs ack UnmarshalJSON

Retrieve all emailaddresses from file, comma seperated

grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" /tmp/t2.txt|awk '{printf "$"$0"$,"}'
@nl5887
nl5887 / gist:0f70d642f6c91f33535e
Created March 10, 2015 17:18
Slack invite by email
v := url.Values{}
v.Set("email", "email")
v.Set("channels", "channel")
v.Set("first_name", "firstname")
v.Set("token", "xox-")
v.Set("set_active", "true")
v.Set("_attempts", "1")
url := fmt.Sprintf("https://%s.slack.com/api/users.admin.invite?t=%d", "team", time.Now().Unix())
@nl5887
nl5887 / nginx.conf
Last active July 4, 2017 13:51
Transparant proxy nginx configuration
user nobody;
worker_processes 1;
error_log logs/error.log;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log debug;
#pid logs/nginx.pid;
daemon off;
package model
import (
"time"
"github.com/jmoiron/sqlx"
db "db"
utils "utils"
)
wget https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/15.07/ejabberd-15.07-0.x86_64.rpm
rpm -i downloads-action.php\?file\=%2Fejabberd%2F15.07%2Fejabberd-15.07-0.x86_64.rpm
@nl5887
nl5887 / config.go
Last active October 30, 2016 14:19
package honeycast
import (
"io/ioutil"
"regexp"
"github.com/imdario/mergo"
"gopkg.in/yaml.v2"
)
@nl5887
nl5887 / stop.sh
Last active December 26, 2017 11:07
stop all lxc instances
#!/bin/bash
lxc-ls --frozen | while read line; do echo Unfreezing $line; lxc-unfreeze --name $line; done < /dev/stdin
lxc-ls --running | while read line; do echo Stopping $line; lxc-stop --name $line; done < /dev/stdin
lxc-ls --frozen|grep -v troje_base | while read line; do echo Stopping $line; lxc-unfreeze --name $line; done < /dev/stdin
lxc-ls --running|grep -v troje_base | while read line; do echo Stopping $line; lxc-stop --name $line; done < /dev/stdin
lxc-ls --stopped|grep -v troje_base | while read line; do echo Stopping $line; lxc-destroy --name $line; done < /dev/stdin
@nl5887
nl5887 / gpg-agent.conf
Last active November 14, 2022 09:37
Using GPG Agent on OS-X
launchctl unload -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
launchctl load -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
sudo cat /private/var/db/com.apple.xpc.launchd/config/user.plist
sudo cat /private/var/db/com.apple.xpc.launchd/config/system.plist
sudo launchctl config user umask nnn
sudo launchctl config system umask nnn