Skip to content

Instantly share code, notes, and snippets.

@hollychen503
hollychen503 / Vagrantfile
Created Jun 15, 2021 — forked from csotomon/Vagrantfile
Vagrant ubuntu with mysql server
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@hollychen503
hollychen503 / gist:d1fbf3c5be7ed97a1b3d062a0214fa5f
Created Mar 4, 2021 — forked from larsks/gist:3933980
Resizing a filesystem using qemu-img and fdisk
View gist:d1fbf3c5be7ed97a1b3d062a0214fa5f

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

View pcm2wav.go
package main
import (
"encoding/binary"
"io"
"log"
"os"
"github.com/go-audio/audio"
"github.com/go-audio/wav"
View gist:f5e2362fdd3214478b52c8b08fa43c98
apt-get install haveged
nano /etc/default/haveged # Setup DAEMON_ARGS="-w 1024"
update-rc.d haveged defaults
cat /dev/random | rngtest -c 1000 # Testing Availability of Entropy & Quality of Random Data
cat /proc/sys/kernel/random/entropy_avail # To test the amount of available entropy
@hollychen503
hollychen503 / modviz.go
Created May 29, 2019 — forked from ajstarks/modviz.go
visualize go modules
View modviz.go
// modviz: visualize go modules
// go mod graph | sed -Ee 's/@[^[:blank:]]+//g' | sort | uniq |
// awk '{print $1}' | sort | uniq -c | sort -nr | awk '{print $2 "\t" $1}' | modviz > f.svg
package main
import (
"bufio"
"flag"
"fmt"
"io"
@hollychen503
hollychen503 / aes_encryption.go
Created Mar 30, 2019 — forked from stupidbodo/aes_encryption.go
AES Encryption Example in Golang
View aes_encryption.go
// Playbook - http://play.golang.org/p/3wFl4lacjX
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
@hollychen503
hollychen503 / bcompare-git.md
Last active Mar 16, 2019 — forked from jfromaniello/bcompare-git.md
Integrate beyond compare 4 with git
View bcompare-git.md

Install command line tools:

then run this:


git config --global diff.tool bc3
git config --global difftool.bc3.trustExitCode true
@hollychen503
hollychen503 / client.go
Created Jan 25, 2019 — forked from hakobe/client.go
golang unix domain socket
View client.go
package main
import (
"io"
"log"
"net"
"time"
)
func reader(r io.Reader) {
@hollychen503
hollychen503 / Makefile
Created Jan 17, 2019 — forked from turtlemonvh/Makefile
Golang Project Makefile Template
View Makefile
# Borrowed from:
# https://github.com/silven/go-example/blob/master/Makefile
# https://vic.demuzere.be/articles/golang-makefile-crosscompile/
BINARY = superdo
VET_REPORT = vet.report
TEST_REPORT = tests.xml
GOARCH = amd64
VERSION?=?
@hollychen503
hollychen503 / httpclient.go
Created Jan 15, 2019 — forked from dmichael/httpclient.go
Light wrapper for the Go http client adding (essential) timeouts for both connect and readwrite.
View httpclient.go
package httpclient
import (
"net"
"net/http"
"time"
)
type Config struct {
ConnectTimeout time.Duration