Skip to content

Instantly share code, notes, and snippets.

View GoesToEleven's full-sized avatar
😀
Enjoy life. Help others.

Todd McLeod GoesToEleven

😀
Enjoy life. Help others.
View GitHub Profile
package main
import (
"net"
"log"
"io"
"fmt"
)
func main() {
Making a bootable USB key from an .iso image on Mac OS X
Purpose
The purpose of this exercise is to take an ISO image that you’ve downloaded and contains a bootable filesystem intended to be burned onto a CDROM. Instead we’re going to put it on a USB key so that a machine with the ability to boot from USB keys can boot it the exact same as if it were a CDROM.
NOTE: Intel Based Apple Machines contain an EFI BIOS that CANNOT boot USB keys. You will not be able to put your OS X .iso file onto a USB key and install it onto an Apple laptop (MacBook Pro/Air/etc).
We’ll be doing most of this from a terminal, with the help of disk utility for some things.
Prepare the USB key
/* disable font boosting on mobile browsers */
body * {
max-height: 1000000em; /* Chrome for Android */
-moz-text-size-adjust: none; /* Firefox Mobile */
}
echo "# sample" >> README.md
git init
git add --all
git commit -m "first commit"
git remote add origin https://github.com/GoesToEleven/sample.git
git push -u origin master
https://git-for-windows.github.io/
Open a Terminal (under Utilities)
Run diskutil list and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
Execute sudo dd if=/path/to/downloaded.iso of=/dev/diskN bs=1m (replace /path/to/downloaded.iso with the path where the image file is located; for example, ./windows7.iso)
Run diskutil eject /dev/diskN and remove your flash media when the command completes (this can take a few hours on slower drives)
@GoesToEleven
GoesToEleven / Golang Buffer (bytes.Buffer)
Created October 27, 2015 05:29
Golang Buffer (bytes.Buffer)
var b bytes.Buffer // A Buffer needs no initialization.
b.Write([]byte("Hello "))
fmt.Fprintf(&b, "world!")
b.WriteTo(os.Stdout)
// OUTPUT:
// Hello world!
@GoesToEleven
GoesToEleven / Daniel's Memcache for Templates
Created October 27, 2015 05:26
Memcache for Templates in Golang
ctx := appengine.NewContext(req)
i, err := memcache.Get(ctx, "Homepage")
if err != memcache.ErrCacheMiss {
buf := bytes.NewBuffer(make([]byte))
writ := io.MultiWriter(res, buf)
tpl.ExecuteTemplate(writ, "home.html", nil)
memcache.Set(ctx, memcache.Item{
Value: buf.String(),
Key: "Homepage",
})
@GoesToEleven
GoesToEleven / GolangPathPackage
Created August 5, 2015 19:08
Golang Path Package - only serve files in certain directory
if path.Dir(req.URL.Path) == "/public/favicons" {
fname := path.Base(req.URL.Path)
http.ServeFile(res, req, "./public/favicons/"+fname)
return
}
@GoesToEleven
GoesToEleven / removing commits from github
Created August 3, 2015 04:17
removing commits from github
$ git reset SHA --hard
// HEAD is now at SHA ...msg...
$ git push origin -f