Instantly share code, notes, and snippets.

xolan / plug_traefik.ex
Created Jul 18, 2018
Handle X-Forwarded-Prefix with Plug.Traefik
View plug_traefik.ex
defmodule Plug.Traefik do
use Plug.Builder
@assets_dir System.cwd <> "/priv/web/assets/"
plug Plug.Static, at: "/assets", from: @assets_dir
plug :x_forwarded_prefix
def x_forwarded_prefix(conn, _) do
register_before_send(conn, fn(conn) ->
varmanishant /
Last active Feb 15, 2019
Install Neovim on Centos 6 from source
# Prerequisites
sudo yum -y install libtool autoconf automake cmake gcc gcc-c++ make pkgconfig unzip
# Installation Folder
mkdir -p ~/packages
cd ~/packages
# Source
git clone
cd neovim
# Build
webgefrickel /
Created Apr 26, 2016
Compiling vim on Ubuntu 16 with LUA-support
# Remove previous installations
sudo apt-get remove vim vim-runtime vim-tiny vim-common
# Install dependencies
sudo apt-get install libncurses5-dev python-dev libperl-dev ruby-dev liblua5.2-dev
# Fix liblua paths
sudo ln -s /usr/include/lua5.2 /usr/include/lua
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/local/lib/
Restuta /
Last active Feb 22, 2019
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – Angular, Ember and React.

All files were downloaded from and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan  4 22:03 angular2.min.js
katowulf / app.js
Last active Dec 20, 2017
Simple paginate example in AngularFire with Firebase.util (
View app.js
var app = angular.module('app', ['firebase']);
app.controller('ctrl', function($scope, $pageArray) {
$scope.pageItems = $pageArray(ref, 'number');
app.factory('$pageArray', function($firebaseArray) {
return function(ref, field) {
// create a Paginate reference
var pageRef = new Firebase.util.Paginate(ref, field, {maxCacheSize: 250});
rcknr /
Last active May 24, 2018
This is a sample code to upload a PDF file to Google Drive with OCR in Apps Script. uploadPdfOcr function returns a File object. To run the code provide a developer key for an API Console project with Drive API service enabled.
function uploadPdfOcr() {
var key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // <-- developer key
var file = UrlFetchApp.fetch("").getBlob();
var metadata = { title: file.getName() }
var params = {method:"post",
oAuthServiceName: "drive",
oAuthUseToken: "always",
contentType: "application/pdf",
contentLength: file.getBytes().length,

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
sjl / gist:1240857
Created Sep 25, 2011
Snow Leopard-compiled DVTM binaries (for Lion users)
View gist:1240857
mhayes / gist:984326
Created May 21, 2011 — forked from kirs/gist:984320
broken rakefile
View gist:984326
require File.expand_path('../config/application', __FILE__)
require 'rake'
module ::Dpp
class Application
include Rake::DSL
module ::RakeFileUtils
tobin / hk.c
Created Apr 8, 2011
Hoshen-Kopelman algorithm for cluster labeling
View hk.c
/* Tobin Fricke's implementation of the
Hoshen-Kopelman algorithm for
cluster labeling.
Copyright (c) September 9, 2000, by Tobin Fricke <>
Modified 2002-03-09 Tobin Fricke
Modified substantially 2004-04-21 by Tobin Fricke
This program is written in the 1999 standard of the C language (C99). Older C