Skip to content

Instantly share code, notes, and snippets.

miguelmota / cmd.go
Created Oct 7, 2018
Golang cobra example
View cmd.go
package cmd
import (
server ""
drandarov-io / D.R.Y. - Reuse Gradle repository definition
Last active May 28, 2019
D.R.Y. - Reuse Gradle repository definition
View D.R.Y. - Reuse Gradle repository definition
This works however:
#### build.gradle
buildscript {
// Repository Configuration
ext.repos = {
maven { url '' }
cespare / main.go
Created Feb 20, 2013
Example of testing Go HTTP servers using httptest.Server.
View main.go
package main
import (
const addr = "localhost:12345"
madevelopers / readzip.go
Created Jan 29, 2015
golang: Read zip file
View readzip.go
package main
import (
type myCloser interface {
Close() error
h4cc / Makefile
Last active Jul 11, 2021
Ubuntu 18.04 Bionic Beaver - Basic packages i usually install
View Makefile
# Ubuntu 18.04 (Bionic Beaver)
# Basic packages i usually install.
# Author: Julius Beckmann <>
# Upgraded Script from 17.04:
# Upgraded Script from 16.04:
francoishill / loop_files_folders_recursively.go
Created Aug 1, 2014
Loop through files and folders recursively in golang
View loop_files_folders_recursively.go
package main
import (
func main() ([]string, error) {
searchDir := "c:/path/to/dir"
whereisaaron /
Last active Aug 23, 2021
Extract a crt file (PEM), key file, and chain bundle from a PFX file, prompts for password or use PFXPASSWORD environment variable
# Extract the key, certficiate, and chain in PEM format from a PFX format file
# Must supply the input pfx file
if [ "${PFX_PATH}" == "" ]; then
echo "Must supply pfx file path"
exit 1
tomcatzh / readwrite.go
Created Apr 1, 2015
Golang readline and writeline
View readwrite.go
func readLines(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
defer file.Close()
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
docwhat / example1
Created Dec 7, 2015
choco install dotnet3.5 fails (but succeeds?)
View example1
PS C:\Users\Administrator> choco install dotnet3.5 -debug -yes
Chocolatey is running on Windows v 6.3.9600.0
Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
Command line: "C:\ProgramData\chocolatey\choco.exe" install dotnet3.5 -debug -yes
Received arguments: install dotnet3.5 -debug -yes
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
espaciomore /
Last active Nov 6, 2021
Watch command for Git Bash
while(true); do
echo -e "${OUTPUT[@]}"