Skip to content

Instantly share code, notes, and snippets.

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@toolmantim
toolmantim / host_based_tld_length.rb
Last active November 18, 2020 17:23
Reconfigures Rails ActionDispatch's TLD handling dynamically based on the request host, so you don't have to mess with config.action_dispatch.tld_length for cross-device testing using xip.io and friends
# Reconfigures ActionDispatch's TLD handling dynamically based on the request
# host, so you don't have to mess with config.action_dispatch.tld_length for
# cross-device testing using xip.io and friends
#
# Examples:
# use Rack::HostBasedTldLength, /xip\.io/, 5
class Rack::HostBasedTldLength
def initialize(app, host_pattern, host_tld_length)
@app = app
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@mattes
mattes / boot2docker-nfs.rb
Last active December 4, 2023 12:07
docker-machine/ boot2docker with NFS instead of vboxsf
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vvvco) my-machine123
# https://gist.github.com/mattes/4d7f435d759ca2581347
require 'erb'
bootlocalsh = %Q(#/bin/bash
@voter101
voter101 / Gulpfile.js
Last active November 29, 2021 01:17
Gulpfile for Rails application with replaced Sprockets with Gulp
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
@BinaryMuse
BinaryMuse / new-pane-commands.js
Created March 17, 2016 05:13
New Atom Pane Commands
// Existing commands that used to be 'pane:split-*'
'pane:split-left-and-copy-active-item'
'pane:split-right-and-copy-active-item'
'pane:split-up-and-copy-active-item'
'pane:split-down-and-copy-active-item'
// New commands to create splits
'pane:split-left'
'pane:split-right'
'pane:split-up'
@tsuna
tsuna / README.md
Created March 27, 2016 04:17
SSL/TLS certificate rotation with gRPC (hack/demo/POC)

gRPC SSL/TLS cert rotation

Generate a couple key pairs:

openssl req -x509 -newkey rsa:2048 -keyout key1.pem -out cert1.pem -days 42 -nodes
openssl req -x509 -newkey rsa:2048 -keyout key2.pem -out cert2.pem -days 42 -nodes
ln -s key1.pem key.pem
ln -s cert1.pem cert.pem
@colophonemes
colophonemes / README.md
Last active March 8, 2024 01:50
Postgres Distributed Key Generation

Postgres Distributed Key Generation

This SQL creates a Postgres function to generate sequential, numeric, unique IDs in a consistent format across services. Useful for database sharding or microservices.

Draws heavily on Instagram's ID generator, via Rob Conery, with minor modifications.

The main changes are that the unique number resolution is per-second rather than per-millisecond. This is to reduce key size below 2^53^-1 so that generated IDs that are under Javascripts Number.MAX_SAFE_INTEGER limit . This is important if you're using these on a Node.js server (e.g. our use case is an Express API using Hashids).

Max IDs are in the order of 51 bits, broken down as follows:

  • 31 bits for the timestamp difference