Skip to content

Instantly share code, notes, and snippets.

View zg's full-sized avatar

Zack Zatkin-Gold zg

View GitHub Profile
@zg
zg / freebsd-qemu-xhyve-mac-os-x-virtual-machine.md
Last active April 1, 2024 21:47
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.

TL;DR

  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.

Requisites

@zg
zg / database.php
Created July 22, 2011 06:59
Login/Register
<?php
//require this to get a database connection
$connect = mysql_connect('localhost','test','test');
mysql_select_db('test');
?>

Keybase proof

I hereby claim:

  • I am zg on github.
  • I am zg (https://keybase.io/zg) on keybase.
  • I have a public key whose fingerprint is 4BEB 7AD4 AEAA FFAF 2E6C BE9A F886 05CB ACE8 3706

To claim this, I am signing this object:

@zg
zg / debian-xhyve.sh
Created May 13, 2016 21:15 — forked from lloeki/debian-xhyve.sh
Running debian 8.1 in xhyve
#!/bin/bash
# unfortunately debian currently panics in xhyve
tmp=$(mktemp -d)
pushd "$tmp"
iso="$HOME"/Downloads/debian-8.1.0-amd64-netinst.iso
#iso="$HOME"/Downloads/debian-8.1.0-i386-netinst.iso
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
@zg
zg / arch-xhyve.sh
Created May 13, 2016 21:14 — forked from lloeki/arch-xhyve.sh
Run Arch Linux in xhyve
#!/bin/bash
tmp=$(mktemp -d)
pushd "$tmp"
iso=/Users/lloeki/Downloads/archlinux-2015.08.01-dual.iso
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=$iso bs=2k skip=1 >> tmp.iso
echo "mounting disk"
from __future__ import division
from pyparsing import (Literal,CaselessLiteral,Word,Combine,Group,Optional,
ZeroOrMore,Forward,nums,alphas,oneOf)
import math
import operator
__author__='Paul McGuire'
__version__ = '$Revision: 0.0 $'
__date__ = '$Date: 2009-03-20 $'
__source__='''http://pyparsing.wikispaces.com/file/view/fourFn.py
@zg
zg / tmux.md
Created December 6, 2013 01:05 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@zg
zg / class.Google2FA.php
Created February 9, 2013 08:30
A PHP implementation of Google two-factor authentication.
<?
class Google2FA {
const keyRegeneration = 30; // Interval between key regeneration
const otpLength = 6; // Length of the Token generated
private static $lut = array( // Lookup needed for Base32 encoding
"A" => 0, "B" => 1,
"C" => 2, "D" => 3,
"E" => 4, "F" => 5,
"G" => 6, "H" => 7,
"I" => 8, "J" => 9,
@zg
zg / cloak.c
Created December 30, 2012 02:36
unreal cloak.c
/*
* IRC - Internet Relay Chat, src/modules/cloak.c
* (C) 2004 The UnrealIRCd Team
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
@zg
zg / TagCloud.java
Created November 9, 2015 00:19
Used for Lobsters tag cloud generated at tagcrowd.com
import java.util.HashMap;
import java.util.Map;
public class TagCloud {
private HashMap<String, Integer> tags;
public static void main(String[] args) {
TagCloud tagcloud = new TagCloud();
}
public TagCloud(){