Skip to content

Instantly share code, notes, and snippets.

@walm
walm / main.go
Last active September 21, 2025 16:52
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@ryzy
ryzy / a.sh
Last active July 19, 2021 02:22
Compile OpenSSL 1.0.2 and HAProxy from the source on CentOS 7
# make sure you have these installed
yum install -y make gcc perl pcre-devel zlib-devel
@dacort
dacort / cookiemonster.go
Created September 23, 2014 06:51
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster domain.com
package main
import (
"code.google.com/p/go.crypto/pbkdf2"
"crypto/aes"
"crypto/cipher"
"crypto/sha1"
"database/sql"
"fmt"
"log"
@hubsgz
hubsgz / RandStr
Created March 21, 2014 07:29
go 生成随机字符串
//生成随机字符串
func RandStr(strlen int) string {
rand.Seed(time.Now().Unix())
data := make([]byte, strlen)
var num int
for i := 0; i < strlen; i++ {
num = rand.Intn(57) + 65
for {
if num>90 && num<97 {
num = rand.Intn(57) + 65
@syzdek
syzdek / ipv6-regex-test.sh
Last active December 19, 2025 02:36
Simple script to test my IPv6 regular expression.
#!/bin/sh
#
# Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c
RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
posixregex -r "^(${RE_IPV4})$" \
127.0.0.1 \
10.0.0.1 \
192.168.1.1 \
@amineck
amineck / gist:4954073
Created February 14, 2013 16:39
mongodump/restore
Backup
> mongodump --db db_name /backup_path/
> mongodump --db db_name --collection collection_name /backup_path/
Restore
> mongorestore --db db_name /backup_folder/
@jordanorelli
jordanorelli / client.go
Created May 7, 2012 17:16
rpc server example in go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {