Skip to content

Instantly share code, notes, and snippets.

View DanLipsitt's full-sized avatar

Dan Lipsitt DanLipsitt

  • Tempo Automation
  • United States
View GitHub Profile
@sebmarkbage
sebmarkbage / DeepImmutableMutation.js
Created May 30, 2014 23:35
Deep Immutable Mutation Using Spread Operator
// Mutative
company.users.push({ name: 'New User' });
return company;
// Immutable
return { ...company, users: [ ...company.users, { name: 'New User' } ] };
// Implicit identifier
@thomasfr
thomasfr / autossh.service
Last active January 5, 2024 08:11
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@ziadsawalha
ziadsawalha / config.py
Created December 19, 2013 19:38
Python module Generic to parse command-line, environment, keyring, and config file options dynamically
"""
Configuration Parser
Configurable parser that will parse config files, environment variables,
keyring, and command-line arguments.
Example test.ini file:
@ulyssesv
ulyssesv / settings.py
Last active January 20, 2016 06:02
Using Honcho to load env vars from a .env file
# -*- coding: utf-8 -*-
import os
if os.environ.get('READ_ENV', False):
from honcho.command import Honcho
h = Honcho()
entries = h.read_env(type('obj', (object,), {'env': '.env', 'app_root': os.path.abspath(os.path.dirname(os.path.dirname(__file__)))})())
h.set_env(entries)
#!/bin/bash
set -o errexit
set -o nounset
if [[ ${#} -ne 1 ]]
then
echo "Usage: ${0} upstart-conf-file" >&2
exit 1
fi
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "./fabric_provisioner.rb"
Vagrant::Config.run do |config|
# snip
config.vm.provision Vagrant::Provisioners::Fabric do |fab|
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@wutali
wutali / fabric.rb
Created July 10, 2012 12:30
Vagrant provisioner of Fabric.
module Vagrant
module Provisioners
class Fabric < Base
class Config < Vagrant::Config::Base
attr_accessor :fabfile_path
attr_accessor :fabric_path
attr_accessor :python_path
attr_writer :tasks
def _default_fabfile_path
@ryangray
ryangray / buttondown.css
Created February 22, 2012 06:45
A clean, minimal CSS stylesheet for Markdown, Pandoc and MultiMarkdown HTML output.
/*
Buttondown
A Markdown/MultiMarkdown/Pandoc HTML output CSS stylesheet
Author: Ryan Gray
Date: 15 Feb 2011
Revised: 21 Feb 2012
General style is clean, with minimal re-definition of the defaults or
overrides of user font settings. The body text and header styles are
left alone except title, author and date classes are centered. A Pandoc TOC