Skip to content

Instantly share code, notes, and snippets.

View porty's full-sized avatar

Robert McNeil porty

View GitHub Profile
@porty
porty / sierra-virtualbox-install.md
Created November 28, 2017 22:50 — forked from arobb/sierra-virtualbox-install.md
Install macOS Sierra in VirtualBox on macOS host

Step 1 (Creating a bootable macOS Sierra ISO for VirtualBox):

  1. hdiutil attach /Applications/Install\ macOS\ Sierra\ Public\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
  2. hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
  3. hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
  4. asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
  5. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
  6. cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
  7. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
@porty
porty / builder.yml
Created October 15, 2017 05:43
Google Cloud templates, hopefully to build AURs within Docker in a Debian machine
imports:
- path: vm-template.jinja
resources:
- name: aur-builder
type: vm-template.jinja
properties:
project: august-impact-91906
zone: australia-southeast1-c
user: shorty
@porty
porty / debug.php
Created March 28, 2017 00:36
How to debug in php
<?php
private function log($args)
{
$str = '';
foreach ($args as $arg) {
if (is_string($arg)) {
$str .= $arg;
} else {
ob_start();
@porty
porty / shell.sh
Last active January 5, 2016 04:35
Buildkite interactive shell
#!/bin/bash
set -e
if [[ $(whoami) != "buildkite-agent" ]]; then
cp $(basename $0) /tmp/shell.sh
sudo su buildkite-agent -s /tmp/shell.sh
exit $?
fi
@porty
porty / ?.sh
Last active August 29, 2015 14:13
Create a minecraft server
# install sudo
apt-get install -y sudo
# allow users to do sudoey things
# change network interface things
@porty
porty / osx_tray_icon.go
Last active August 29, 2015 14:13
OSX Tray Icon in Go
package main
// http://www.cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
// https://github.com/TooTallNate/NodObjC/blob/master/examples/NodeCocoaHelloWorld.app/Contents/MacOS/app.js
// https://github.com/TooTallNate/NodObjC/issues/21
// http://www.gnustep.it/nicola/Tutorials/FirstGUIApplication/node3.html
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
@porty
porty / building.md
Last active August 29, 2015 14:07
Doom Legacy on Mac

Extract source tarball, run make:

$ make
make: sdl-config: Command not found
g++ -std=c++11 -Wall -MP -MMD -g -O0 -mwindows -D__WIN32__ -DSDL -DNO_MIXER  -Iinclude -c src/engine/g_game.cpp -o build/engine/g_game.o
clang: error: unknown argument: '-mwindows'
make: *** [build/engine/g_game.o] Error 1
@porty
porty / README.md
Last active November 1, 2016 00:29
Ruby method call display

Ruby Method Call Display Thing

Displays what methods are getting called, with what arguments, and their return values or exceptions thrown.

You just have to include Hax in the class you want to look at

This will probably break if your method is expecting a block

$ ruby example.rb
@porty
porty / main.go
Last active August 29, 2015 14:05
Emitter
package main
import (
"bufio"
"fmt"
"io"
"os"
"github.com/porty/emitter"
)
@porty
porty / network_throttling_on_linux.md
Last active August 29, 2015 14:04
Network throttling on Linux

Latency

tc qdisc add dev INTERFACE root netem delay 50ms

Packet loss

tc qdisc add dev INTERFACE root netem loss 50%

Bandwidth