Skip to content

Instantly share code, notes, and snippets.

@jackspirou
jackspirou / private_fork.md
Created November 14, 2023 20:20 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@jackspirou
jackspirou / checksum.go
Last active January 15, 2016 03:25
Generate checksums in Go. Keep it simple, keep it safe.
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"fmt"
"hash/adler32"
"hash/crc32"
@jackspirou
jackspirou / container.service
Created January 9, 2016 20:07
systemd container
[Unit]
Description=Foobar
Requires=flanneld.service
After=flanneld.service
Requires=docker.service
After=docker.service
Requires=etcd2.service
After=etcd2.service
@jackspirou
jackspirou / update_docker_image_drone4.sh
Last active November 1, 2015 17:39
A quick script to update a running drone/drone:0.4 docker image.
#!/bin/bash
# first stop and remove your running Drone instance
sudo docker stop drone
sudo docker rm drone
# pull the latest Drone image
sudo docker pull drone/drone:0.4
@jackspirou
jackspirou / install_docker_aufs.sh
Created October 26, 2015 23:48
This script is for installing docker using AUSF on Ubuntu 14.04. It is a combination of input from this gist: https://gist.github.com/parente/025dcb2b9400a12d1a9f
#!/bin/bash
sudo rm -rf /var/lib/docker
sudo service docker stop
sudo apt-get remove lxc-docker
sudo apt-get autoremove
which docker # show docker version
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
@jackspirou
jackspirou / rewriteImportPaths.go
Last active December 21, 2022 17:48
A method for rewriting golang import paths.
package importpaths
import (
"log"
"os"
"strconv"
"strings"
"go/ast"
"go/parser"
@jackspirou
jackspirou / StringMapStringMarshalXML.go
Last active January 22, 2024 06:42
Marshal a map of strings to strings to XML in Golang.
// StringMap is a map[string]string.
type StringMap map[string]string
// StringMap marshals into XML.
func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
tokens := []xml.Token{start}
for key, value := range s {