Skip to content

Instantly share code, notes, and snippets.

View predominant's full-sized avatar
🦄

Graham Weldon predominant

🦄
View GitHub Profile
#!/bin/bash
INTERFACE="en0"
MACCMD="ifconfig $INTERFACE ether"
MACREAL="aa:aa:aa:aa:aa:aa"
MACFAKE="bb:bb:bb:bb:bb:bb"
function usage {
echo "Usage:"
echo " mac fake"
search("users", "*:*").each do |user_data|
user user_data['id'] do
comment user_data['comment']
uid user_data['uid']
gid user_data['gid']
home user_data['home']
shell user_data['shell']
end
end
@predominant
predominant / drone.log
Created August 17, 2015 05:49
Drone error when deleting repo
2015/08/17 01:55:16 http: panic serving 10.68.10.81:64815: runtime error: invalid memory address or nil pointer dereference
goroutine 26 [running]:
net/http.func·011()
/usr/local/go/src/pkg/net/http/server.go:1100 +0xb7
runtime.panic(0xb3b7a0, 0x11ae913)
/usr/local/go/src/pkg/runtime/panic.c:248 +0x18d
github.com/drone/drone/plugin/remote/github.DeleteKey(0xc2080457c0, 0xc20816cb78, 0x4, 0xc20816cb90, 0x7, 0xc208172460, 0x1b, 0xc2080aa780, 0x17d, 0x0, ...)
/var/cache/drone/src/github.com/drone/drone/plugin/remote/github/helper.go:250 +0xfe
github.com/drone/drone/plugin/remote/github.(*GitHub).Deactivate(0xc2080265b0, 0xc208042c60, 0xc208056e00, 0xc208160310, 0x64, 0x0, 0x0)
/var/cache/drone/src/github.com/drone/drone/plugin/remote/github/github.go:207 +0x164
protected void PlaneSplit1() {
Mesh mesh = this.GetMesh();
Vector3[] vertices = mesh.vertices;
for (int pass = 0; pass < this.Passes; pass++) {
// Pick a random point in the Sphere
Vector3 splitVector = Random.insideUnitSphere;
for (int i = 0; i < mesh.vertices.Length; i++) {
// Get the DOT product of that random point
<?php
class A {
private static $__value = 'Foo';
public function getValue() {
return self::$__value;
}
}
class B {
<?php
$string = uniqid();
$start = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
crc32($string);
}
$elapsed = microtime(true) - $start;
echo "crc32 => $elapsed\n";
<?php
/**
* Configuration options
*
*/
$iterations = 10000000;
info();
/**
* Actual Benchmarks to run
#!/opt/local/bin/php
<?php
// Get a git log
$log = trim(`git shortlog -s -n -e`);
$log = explode("\n", $log);
// Clean and make a new directory for images.
`rm -rf gource-gravatars`;
mkdir('gource-gravatars');
// --- Controller
class TestsController extends Controller {
public $uses = array();
public function add() {
$x = new App();
$x->__cache = 1;
@predominant
predominant / cdcupdate.php
Created December 22, 2010 23:13
CakeDC repo downloader, and updater. For the truly lazy.
#!/usr/bin/php
<?php
if ($argc <= 1) {
$account = 'CakeDC';
} else {
$account = $argv[1];
}
if ($argc <= 2) {