Skip to content

Instantly share code, notes, and snippets.

@fridgerator
fridgerator / instructions.md
Created Nov 14, 2019
Auto-renewing Lets Encrypt certificates for Rancher 1.6
View instructions.md

Lets Encrypt has removed their ACME V1 api in favor of ACME V2. The Rancher 1.6 catalog entry for Lets Encrypt certificates doesn't support this api. There is a forked version of the repo, however the service has to be created manually instead of from the catalog.

  1. Create a new service, give it a name, use vxcontrol/rancher-letsencrypt:v1.0.0 for the image
  2. In the "Volumes" tab, add a volume /var/lib/rancher:/var/lib/rancher
  3. In the "Command" tab, set the "Console" option to none
  4. Click to add an Environment Variable, and paste the following into the first "Variable" input field.
  • All of the environment variables should auto-fill.
  • Fill in the necessary values
View Readme.md

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@brianloveswords
brianloveswords / git-obliterate
Last active Jun 14, 2020
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
View git-obliterate
#!/bin/bash
file=$1
test -z $file && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
git ignore $file
git add .gitignore
git commit -m "Add $file to .gitignore"
@wookiehangover
wookiehangover / define-wrapper.js
Created May 18, 2013
connect middleware that wraps serves common-js modules wrapped with AMD define()
View define-wrapper.js
var fs = require('fs');
var path = require('path');
var url = require('url');
module.exports = function(directory, blacklist) {
if( directory === undefined ) {
throw new Error('You need to pass a location to work with');
}
blacklist = blacklist || [];
@wookiehangover
wookiehangover / less-middleware.js
Last active Dec 14, 2015
Express Middleware for processing less on the fly in development mode.
View less-middleware.js
/*
* Less Middleware
*
* Captures requests for your production css and serves a compiled less bundle
* in its place. Less parser is pretty quick, no noticeable load times when
* parsing bootstrap & custom less on every request. Errors are printed to the
* console.
*
* Meant to be mounted to your css directory, eg:
*
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@wookiehangover
wookiehangover / Cakefile
Created Dec 24, 2011
a pretty-good build script, with Cake
View Cakefile
# Dependencies
fs = require('fs')
{_} = require('underscore')
path = require('path')
tmpl = require('handlebars-jst')
{log} = require('util')
growl = require('growl')
stitch = require('stitch')
uglify = require('uglify-js')
@tbranyen
tbranyen / server.js
Last active Jul 28, 2019
backbone/node.js pushState enabled server
View server.js
// Require libraries
var os = require("os");
var fs = require("fs");
var readline = require("readline");
var cluster = require("cluster");
var express = require("express");
var site = express();
// Var up, bro
var i, read;
@cowboy
cowboy / multi-firefox-fixer.sh
Created Mar 14, 2011
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
View multi-firefox-fixer.sh
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
Multi-Firefox Fixer - v0.2 - 4/26/2011
http://benalman.com/
Usage: `basename "$0"`
Run this shell script from beside (in the same parent directory as) one or more
Firefox*.app or Aurora*.app applications and it will "fix" those Firefoxes to
@cowboy
cowboy / jquery.ba-whenthen.js
Created Mar 12, 2011
jQuery's "when" and "then" all rolled up together.
View jquery.ba-whenthen.js
/*!
* jQuery whenthen - v0.2 - 3/12/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
You can’t perform that action at this time.