Skip to content

Instantly share code, notes, and snippets.

@nkabir
nkabir / normalise_environment.py
Created December 14, 2022 15:43 — forked from michalc/normalise_environment.py
Structured data in environment variables: nested dictionaries and lists
def normalise_environment(key_values):
''' Converts denormalised dict of (string -> string) pairs, where the first string
is treated as a path into a nested list/dictionary structure
{
"FOO__1__BAR": "setting-1",
"FOO__1__BAZ": "setting-2",
"FOO__2__FOO": "setting-3",
"FOO__2__BAR": "setting-4",
"FIZZ": "setting-5",
@nkabir
nkabir / docker-compose.yml
Created June 16, 2022 09:42 — forked from tomasfejfar/docker-compose.yml
Using YAML to reuse parts of existing docker-compose configuration
version: "3"
services:
apache: &apacheConfig
build: .
volumes:
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
working_dir: /var/www/html
ports:
@nkabir
nkabir / export-google-docs-to-restructured-text.js
Created March 30, 2020 12:22 — forked from simonw/export-google-docs-to-restructured-text.js
Google Apps script to convert a Google Docs document into reStructuredText
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Convert to .RST')
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText')
.addToUi();
}
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini
// License: Apache License Version 2.0
String.prototype.repeat = String.prototype.repeat || function(num) {
@nkabir
nkabir / distribute_setup.py
Last active August 30, 2019 17:50 — forked from elijah/distribute_setup.py
legacy-distribute
#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
@nkabir
nkabir / sh_env_var_opts.sh
Created April 13, 2016 18:47 — forked from KylePDavis/sh_env_var_opts.sh
Simple bash shell script templates. There are two versions: 1) simple env var based options, and 2) with added command line argument parsing and error handling.
#!/bin/bash -e
# A SHORT DESCRIPTION OF YOUR SCRIPT GOES HERE
# USAGE:
# DESCRIPTION OF ENV VARS HERE
###############################################################################
set -e # exit on command errors (so you MUST handle exit codes properly!)
set -o pipefail # capture fail exit codes in piped commands
#set -x # execution tracing debug messages
# Get command info
@nkabir
nkabir / bookmarks.md
Created November 1, 2015 18:55 — forked from boneskull/bookmarks.md
How to use Mercurial bookmarks

How to Use Mercurial Bookmarks

Note: This document is specific to the FocusVision development environment, however it's mostly applicable elsewhere.

by Christopher Hiller

Mercurial branches are not "cheap". Unlike Git, to create or destroy a branch, you actually have to commit a changeset to the repository. Branches are great for…something…but whatever that is, we're not doing it.

Enter Bookmarks.

<VirtualHost *:80>
ServerAdmin admin@example.org
ServerName elasticsearch.domain.tld
ServerAlias kibana.domain.tld
DocumentRoot /path/to/kibana/docroot
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path/to/kibana/docroot>
var adv = {};
adv.Adv = function (data) {
this.symList = m.prop([]);
this.barSize = m.prop(10);
this.days = m.prop(5);
this.pb = pb.init();
this.path = this.pb.url + 'adv/';
this.message = 'AverageDailyVolume';
this.request = this.pb.ts[this.message + 'Request'];
this.response = this.pb.ts[this.message + 'Response'];
<!DOCTYPE html>
<script type="text/javascript" src="http:cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/highstock/1.3.7/highstock.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/usdeur.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.18/mithril.min.js"></script>
<script type="text/javascript">
var app = {};
app.App = function(data){
this.plotCfg = {
chart: {

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: