This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package main implements the mocker program, which is capable of creating | |
// container images for systemd-nspawn from Dockerfile configuration. | |
// | |
// It uses docker to extract the root filesystem of the image, but then | |
// runs all of the RUN commands from the systemd container. | |
// | |
// You have to ensure that the Dockerfile is installing systemd for the | |
// distro of the image, because these containers will be booted by using | |
// systemd-nspawn and they fail if there's no systemd inside the image. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package walkstruct | |
import ( | |
"fmt" | |
"reflect" | |
"unicode" | |
) | |
// WalkStruct walks the exported fields of a struct using reflection, | |
// and calls fn for each field. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FRAMES_DIR=frames.$$ | |
trap "rm -rf ${FRAMES_DIR}" EXIT | |
FPS=10 | |
WIDTH=480 | |
FONT_COLOR=white | |
INPUT="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Implementation of http://www.calculatorsoup.com/calculators/algebra/percent-difference-calculator.php | |
v1=5067 | |
v2=5733 | |
def diff(v1, v2): | |
f1, f2 = float(v1), float(v2) | |
v = 1 - ((f1 - f2) / ((f1 + f2) / 2) * 100) - 1 | |
return v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple groupcache example: https://github.com/golang/groupcache | |
// Running 3 instances: | |
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081 | |
// Testing: | |
// curl localhost:8080/color?name=red | |
package main | |
import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/csv" | |
"encoding/json" | |
"encoding/xml" | |
"fmt" | |
"log" | |
"math/rand" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func RoundUp(v int) int { | |
return 10 * ((v + 9) / 10) | |
} | |
func RoundDown(v int) int { | |
return 10 * (v / 10) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import time | |
from getopt import getopt | |
from PIL import Image | |
from selenium import webdriver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"log" | |
"os" | |
"os/exec" | |
"strings" | |
"github.com/nlopes/slack" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"io" | |
"net/http" | |
"os" | |
"strings" | |
"github.com/gorilla/handlers" |
NewerOlder