Skip to content

Instantly share code, notes, and snippets.

View mikekunze's full-sized avatar

Mike Kunze mikekunze

View GitHub Profile
@mikekunze
mikekunze / gitlab-6.4-dockerfile
Created January 19, 2014 18:22
This creates a gitlab server
# From ubuntu 12.04
FROM ubuntu:latest
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d; chmod +x /usr/sbin/policy-rc.d;\
dpkg-divert --local --rename --add /sbin/initctl;\
ln -s /bin/true /sbin/initctl
ADD ./init.sh /tmp/init.sh
RUN /bin/bash /tmp/init.sh && rm /tmp/init.sh
export DEBIAN_FRONTEND=noninteractive
echo "deb http://archive.ubuntu.com/ubuntu/ precise main universe" > /etc/apt/sources.list; apt-get update;
apt-get -y install apache2 php5 php5-gd libapache2-mod-php5 postfix wget supervisor ssh php5-pgsql vim curl libcurl3 libcurl3-dev php5-curl php5-xmlrpc php5-intl
echo "root:admin" | chpasswd; mkdir /var/run/sshd
cd /tmp; tar zxvf moodle-2.6.tgz; mv /tmp/moodle /var/www
@mikekunze
mikekunze / install-node.sh
Created December 10, 2013 22:57
sh script to quickly install node with express, coffee, and bower
#!/bin/sh
wget http://nodejs.org/dist/v0.10.22/node-v0.10.22-linux-x64.tar.gz
tar zxvf node-v0.10.22-linux-x64.tar.gz
mv node-v0.10.22-linux-x64 /opt/node
ln -s /opt/node/bin/node /bin/node
ln -s /opt/node/bin/npm /bin/npm
npm install -g coffee-script bower express
@mikekunze
mikekunze / CreateUserMySite.ps1
Created November 21, 2013 19:24
This is a basic script that loads the powershell cmdlets for SharePoint and then creates a MySite if not exist for the user defined in $user
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
$user = "mkunze"
$site = get-spsite("https://domain.com/mysites")
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
@mikekunze
mikekunze / Ubuntu-Desktop-Vagrantfile
Created November 15, 2013 15:50
Ubuntu-Desktop-Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
​VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@mikekunze
mikekunze / timerSpawn.coffee
Last active December 27, 2015 01:19
This is a timer for running multiple compiled matlab binaries in parallel on a server with more than 30 cores. It uses async to wait before all processes exit before calculating total processing time.
# To run this, grab the x64 node.js binary tarball and extract it to ~/node
#
# Then:
# ln -s ~/node/bin/node ~/bin/node; ln -s ~/node/bin/npm ~/bin/npm
# npm install coffee-script
# ln -s ~/node_modules/coffee-script/bin/coffee ~/bin/coffee
#
# Run:
# coffee timer.coffee
@mikekunze
mikekunze / drupal-Dockerfile
Last active December 26, 2015 10:39
This dockerfile will spawn up a simple drupal container for getting started with drupal core. You must provide your own main.cf file for postfix. mailname is a file that contains your hostname. start.coffee is the coffee-script file that is run that spawns necessary processes and creates the database. the nodebuntu image has node, npm, and coffe…
FROM nodebuntu
RUN apt-get -y install apache2 php5 php5-mysql mysql-server php5-gd wget postfix
RUN rm /etc/postfix/main.cf
ADD ./main.cf /etc/postfix/main.cf
ADD ./mailname /etc/mailname
@mikekunze
mikekunze / drupal-docker-start.coffee
Created October 24, 2013 13:36
This coffee script is meant to be used with a docker container running drupal instances. It starts mysql, httpd, postfix, and waits for mysql to boot up before creating the drupal database.
spawn = require('child_process').spawn
dohttpd = ()->
httpd = spawn '/etc/init.d/apache2', ['start']
httpd.stdout.setEncoding 'utf8'
httpd.stderr.setEncoding 'utf8'
httpd.stdout.on 'data', (data)->
console.log data
@mikekunze
mikekunze / closureNoSQL.coffee
Created October 19, 2013 14:58
We can do some fun stuff in Node.JS with asynchronous programming. With closures, we can pull a document collection from a NoSQL database, manipulate the results, and push it to an array stored via closure in the parent scope.
require './nosql'
require 'async'
# new results array. this will be available via closure
results = []
# Start the NoSQL connection
nosql.connect ()->
# Get the collection pointer
@mikekunze
mikekunze / carClass.js
Created October 19, 2013 14:42
The concept of closures in javascript is important to understand because you might not even know you're doing it. If you write in coffee-script classes or do classical inheritance patterns in vanilla javascript, you are using closures. The following example is a starting point for classical inheritance in javascript. This shows how to hide priva…
function car() {
// Private Variable
var val = {
make : "generic",
model : "generic",
color : "generic"
};
// "new" instance