Skip to content

Instantly share code, notes, and snippets.

View rjmoggach's full-sized avatar
🦄
React'ing.

Robert Moggach rjmoggach

🦄
React'ing.
View GitHub Profile
@rjmoggach
rjmoggach / webfaction_meteor.py
Last active August 18, 2017 12:41
Webfaction MongoDB/Meteor Install
#!/usr/local/bin/python2.7
import xmlrpclib
import os
import socket
import wget
import getpass
from subprocess import call
# Set some defaults
@rjmoggach
rjmoggach / webfaction_gitlab.md
Last active October 8, 2023 08:39
Webfaction GitLab Install

Install Gitlab on webfaction

November 2014

I wanted to install gitlab on my shared hosting server at webfaction and here's how I did it. Be warned it's a memory hog. I couldn't get it below 450Mb. Also... this is for their newer 64 bit servers. I tried on a 32 bit server and didn't want to waste a day tracking down dependencies.

Create app for gitlab

Create a new app (using python)

@rjmoggach
rjmoggach / bashScope.sh
Last active February 6, 2018 04:52
Bash Function Scope
#!/bin/env bash
ARG01="moderately $1"
ARG02="seriously $2"
sanity_check() {
local you=$1
local me=$2
echo "You are $you"
echo "I am $me"
@rjmoggach
rjmoggach / randomPassword.sh
Created October 11, 2014 21:44
Random Password Generator
function random_pass {
CHARACTER_ARRAY=("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "+" "-" "." "@" "%")
RANGE=67
COUNTER=1
while [ $COUNTER -lt 16 ]; do
row[$COUNTER]=$RANDOM
let "row[$COUNTER] %= $RANGE"
while [ ${row[$COUNTER]} = 0 ]; do
row[$COUNTER]=$RANDOM
let "row[$COUNTER] %= $RANGE"
@rjmoggach
rjmoggach / importSVGFilesAsLayers.js
Created May 30, 2014 07:07
Illustrator script to import a folder of SVG files into separate offset layers
// Import SVG Files as Layers - Illustrator CS3 script
// Description: Imports a folder of SVG files as named layers into a new document
// Author: Robert Moggach ([email protected])
// Version: 0.0.1 on 2014-05-29
function getFolder() {
return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
}
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo natd -interface en1
$ sudo ipfw add divert natd ip from any to any via en1
@rjmoggach
rjmoggach / PersonController.js
Created January 31, 2014 23:59
waterline issue with null foreign keys
index: function(req, res) {
Person
.find()
.populate('user')
.exec(function peopleFound(err, people) {
console.log(err);
if (err) return res.json(err, 400);
if (!people) return res.json({ error: 'No people exist.' }, 404);
res.json(people);
});
@rjmoggach
rjmoggach / responsive-margins.less
Last active August 30, 2017 00:47
Responsive Margin & Padding Shortcuts for Twitter Bootstrap Using LESS CSS
//
// Responsive Margin & Padding Shortcuts for Twitter Bootstrap 3.0
// ---------------------------------------------------------------
// This is an addition to Twitter Bootstrap that allows additional margin and padding shortcuts
// for enhanced layout control purposes. It should be included after the bootstrap.less
// import statement or precompiled as you see fit. It differs from bootstrap standards in
// that for any given screen size it predetermines the margin/padding size. All you have to
// do is specify the size you want xs,sm,md,lg, or xl. The exception is for items that you
// want to be centered using auto left/right margins. This can be device responsive by
// specifying mc-xs, mc-sm, mc-md, or mc-lg depending on when you want that behavior.
@rjmoggach
rjmoggach / font_family.py
Created May 8, 2013 14:16
Python script to change the font family of individual font files. It's useful if you have multiple fonts that should be the same family but are not grouped together in GUI software.
#!/usr/bin/python
import os, sys, string, re, MacOS
from string import capwords
import fontforge as ff
from optparse import OptionParser
SKIP_FILES = ['.DS_Store', '.AppleDB', 'convert_font.log', 'Icon?']
class DirectoryWalker:
@rjmoggach
rjmoggach / font_convert.py
Created May 8, 2013 14:13
Python script to convert a hierarchy of fonts to OTF format This is useful if you have a huge collection of mac fonts that use resource forks and want cross platform fonts. Use at your own risk. It's not fully tested. Backup your originals before you run the script to be safe. It requires the fontforge python library.
#!/usr/bin/python
import os, sys, string, re, MacOS
from string import capwords
import fontforge as ff
from optparse import OptionParser
TEST = False
SKIP_FILES = ['.DS_Store', '.AppleDB', 'convert_font.log', 'Icon?']
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'