Skip to content

Instantly share code, notes, and snippets.

View bhgraham's full-sized avatar

Benjamin H. Graham bhgraham

View GitHub Profile
/**
* Add an item to an Elgg menu
*
* @param string $menu The name of the menu: site, page, userhover, userprofile, groupprofile, or any custom menu
* @param string $id The unique identifier for this menu item. An example is blog:add
* @param string $title The localized title string for this menu item
* @param string $url The URL for this menu item
* @param array $options An associative array of menu options including: tooltip, parent, or custom option.
* tooltip: string that is used as the title element of the link
* parent: the $id of the item's parent
<?php
/**
* This is just a quick hack to get the data directory for a user
*/
// load engine - this assumes the script has been put in the root directory of Elgg
require_once(dirname(__FILE__) . "/engine/start.php");
global $CONFIG;
@bhgraham
bhgraham / marblemousefix.sh
Created November 12, 2012 18:03
marblemouse fix stupid scrolling/copy paste action
xinput set-button-map "Logitech USB Trackball" 1 8 3 4 5 6 7 2 9
@bhgraham
bhgraham / .gitignore
Last active December 12, 2015 00:48 — forked from karmi/.gitignore
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@bhgraham
bhgraham / gitlab.sh
Last active December 12, 2015 09:39 — forked from cristianrasch/gitlab.sh
aptitude install -y git curl python-dev python-pip redis-server ruby1.9.1-full rubygems1.9.1
ln -s /usr/bin/ruby /usr/local/bin/ruby
ln -s /usr/bin/gem1.9.1 /usr/local/bin/gem
rm /usr/bin/ruby /usr/bin/gem
aptitude install -y mysql-server libmysqlclient-dev
adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git
adduser --disabled-login --gecos 'gitlab system' gitlab
usermod -a -G git gitlab
su - gitlab
ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa
@bhgraham
bhgraham / projects.rb
Created February 14, 2013 09:09
gitlab/lib/api/projects.rb only changed the lines mentioning namespace_id. these were added to allow project creation within namespace (from API). If not used, it defaults to your username. This allows gh2gl to work "git clone http://code.a8.lc/administr8/github2gitlab.git" for github to gitlab migrations.
# Create new project
#
# Parameters:
# name (required) - name for new project
# description (optional) - short project description
# default_branch (optional) - 'master' by default
# issues_enabled (optional) - enabled by default
# wall_enabled (optional) - enabled by default
# merge_requests_enabled (optional) - enabled by default
# wiki_enabled (optional) - enabled by default
@bhgraham
bhgraham / 0_reuse_code.js
Created August 17, 2014 03:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bhgraham
bhgraham / install_dockermac
Created December 31, 2014 01:57
Quick Install for Docker on Mac OSX
# Quick Install for Docker on Mac OSX
# Author: Benjamin H. Graham <bman@bman.io>
# Must be run as root
# Usage: curl -s bman.io/i/install_dockermac|sudo bash
cd ~
echo "Downloading docker binary";
curl -Ls "https://github.com/boot2docker/osx-installer/releases/download/v1.2.0/Boot2Docker-1.2.0.pkg" -o "Boot2Docker-1.2.0.pkg";
echo "Installing docker service";
installer -pkg Boot2Docker-1.2.0.pkg -target /;
@bhgraham
bhgraham / install_dockerdeb
Created December 31, 2014 02:01
Quick Install for Docker on Debian (LMDE, Mint, Ubuntu, etc)
# Quick Install for Docker on Debian (LMDE, Mint, Ubuntu, etc)
# Author: Benjamin H. Graham <bman@bman.io>
# Usage: curl -s bman.io/i/install_dockerdeb | bash
# Add debian repo
echo "Adding the debian repository for docker"
echo deb http://get.docker.io/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo "Updating apt repos"
sudo apt-get update -qq
@bhgraham
bhgraham / debmigrate
Last active August 29, 2015 14:16
Migrate all installed packages between debian based machines.
#!/bin/bash
#
# Author: Benjamin H. Graham (me@bman.io)
# Copyright: 2015 Administr8 (http://administr8.me)
# License : GNU GPL v2 (http://www.gnu.org/licenses/gpl-2.0.html)
# dump packages to pastebin, return hash
# restore packages from pastebin with hash input
VERSION="1.0.0";