Skip to content

Instantly share code, notes, and snippets.

@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@benileo
benileo / mongod.service
Last active March 1, 2021 04:57
Systemd Service Script for Mongod On Ubuntu 15.04, 15.10, 16.04 Xenial
[Unit]
Description=High-performance, schema-free document-oriented database
Documentation=man:mongod(1)
After=network.target
[Service]
Type=forking
User=mongodb
Group=mongodb
const reduce = Array.reduce;
// Call function `f` with value `x`.
const callWith = (x, f) => f(x);
// Pipe value `x` through many single-argument functions in succession.
// This is kind of like a Unix pipe. The value of the previous function is
// passed to the next function, etc. Note that functions are called
// from left-to-right, with left being first.
export const pipe = (x, ...f) => reduce(f, callWith, x);
@andyj
andyj / gist:2355649
Created April 10, 2012 23:37
Express, Less and less-middleware
$ mkdir expressWithLess && cd expressWithLess
$ express --css less-middleware && npm install
$ mv public/stylesheets/ public/styles
$ nano public/styles/style.less
@color: #00B7FF;
body { padding: 200px; font: 18px "Lucida Grande", Helvetica, Arial, sans-serif; }
@gabetax
gabetax / example.html
Created January 30, 2012 05:42
XHTML to Markdown XSLT Translation
<html>
<body>
<h1>Our Navigation</h1>
<p>I'm writing an example xhtml document to get converted into markdown!</p>
<h2>Examples</h2>
<h3>Text formatting</h3>
<p>Sometimes with longer <em>paragraphs</em><br/>we just want a new line <strong>immediately</strong>.</p>
<div>Divs are block elements too, and people don't always put their text in p tags.</div>
@Folcon
Folcon / clipboard-utils.clj
Created August 24, 2011 11:50
Just a quick clipboard slip/slurp I put together because I didn't find anything similar, don't know if it's useful for anyone but found it invaluable when getting large strings being returned from the repl and sticking the result in an editor for more car
(defn get-clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp-clipboard []
(try
(.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))
(defn spit-clipboard [text]
(.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil))