Skip to content

Instantly share code, notes, and snippets.

View lawrence79's full-sized avatar

Lawrence Norton lawrence79

View GitHub Profile
@lawrence79
lawrence79 / mac_setup.sh
Created March 13, 2024 12:40 — forked from kpritam/mac_setup.sh
Setup new mac book (Installs brew, fish, iterm2, java, scala, sbt, chrome, slack, vs code, flycut etc.)
###########################################################
# Homebrew
# Fish Shell
# Fisherman
# Powerline Fonts
# iTerm2
curl https://raw.githubusercontent.com/ellerbrock/fish-shell-setup-osx/master/install.sh | bash
@lawrence79
lawrence79 / frontendDevlopmentBookmarks.md
Created April 5, 2016 14:26 — forked from mobeendev/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
# file /etc/sudoers.d/go
# preferably edit using visudo -f <file>
# allow the go user to run some commands using sudo. Need to specify full path to command.
Cmnd_Alias GO_SUDO_CMDS = /usr/sbin/vzctl, /bin/umount /mnt/vzdata/*/projectdata
# don't require a tty for running sudo
Defaults!GO_SUDO_CMDS !requiretty
# don't require password
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
// node.js proxy server example for adding CORS headers to any existing http services.
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities
var httpProxy = require('http-proxy'),
express = require('express');
var proxy = new httpProxy.RoutingProxy();
var proxyOptions = {
host: '192.168.3.11',
@lawrence79
lawrence79 / sort.rb
Created October 16, 2013 00:01 — forked from aspyct/sort.rb
# Sample implementation of quicksort and mergesort in ruby
# Both algorithm sort in O(n * lg(n)) time
# Quicksort works inplace, where mergesort works in a new array
def quicksort(array, from=0, to=nil)
if to == nil
# Sort the whole array, by default
to = array.count - 1
end
description "Upstart script to run a nodejs app as a service"
author "Louis Chatriot"
env NODE_BIN=/usr/local/bin/node
env APP_DIR=/path/to/app/dir
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app
env LOG_FILE=/path/to/logfile.log
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)
# I typically use the environment variable NODE_ENV (see below)
(function() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */