Skip to content

Instantly share code, notes, and snippets.

View walm's full-sized avatar

Andreas Wålm walm

  • Sweden
View GitHub Profile
@walm
walm / app.go
Created December 4, 2019 19:43 — forked from sdorra/app.go
SSEvents with golang
package main
import (
"io"
"strconv"
"time"
"github.com/gin-gonic/gin"
)
@walm
walm / simple-gpg-enc.go
Created March 6, 2018 07:32 — forked from stuart-warren/simple-gpg-enc.go
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@walm
walm / personnummer.rb
Created November 24, 2017 09:21 — forked from henrik/personnummer.rb
Generate valid Swedish personnummer.
# Generator for valid Swedish personnummer: http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)
# By Henrik Nyh <http://henrik.nyh.se> 2009-01-29 under the MIT license.
require 'date'
module Personnummer
def self.generate(date=nil, serial=nil)
date ||= Date.new(1900+rand(100), 1+rand(12), 1+rand(28))
serial = serial ? serial.to_s : format("%03d", 1+rand(999)) # 001-999

Keybase proof

I hereby claim:

  • I am walm on github.
  • I am walm (https://keybase.io/walm) on keybase.
  • I have a public key ASD8wyxTFZJesCUccx3W7f6f_0s6nB8YW0VgXSpzcwIHfwo

To claim this, I am signing this object:

@walm
walm / conventional-json.go
Created February 2, 2017 21:26 — forked from Rican7/conventional-json.go
Marshal JSON in Golang using common lower-camel-case object key conventions
package main
import (
"bytes"
"encoding/json"
"fmt"
"regexp"
"time"
)
@walm
walm / install.md
Last active October 17, 2021 19:46
Arch Linux on VMWare

Install in VMWare

  1. Boot from ISO
  2. Keyboard: loadkeys sv-latin1
  3. Partitions boot, swap and root (home will use just use root)
     gdisk /dev/sda

     # create boot partition
     # >n
@walm
walm / main.go
Last active May 15, 2024 06:01
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@walm
walm / concat-pdf.sh
Created February 7, 2016 19:37
concat pdf with gs
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf
@walm
walm / go-test-color.sh
Created January 25, 2016 15:42
go test with color
go test -v ./... | \
sed ''/PASS/s//$$(printf "\033[32mPASS\033[0m")/'' | \
sed ''/SKIP/s//$$(printf "\033[34mSKIP\033[0m")/'' | \
sed ''/FAIL/s//$$(printf "\033[31mFAIL\033[0m")/''
@walm
walm / sshd.go
Last active September 22, 2015 07:15 — forked from jpillora/sshd.go
Go 1.3 SSH server complete example
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client: