Skip to content

Instantly share code, notes, and snippets.

View snowch's full-sized avatar

Chris Snow snowch

View GitHub Profile
@snowch
snowch / GIF-Screencast-OSX.md
Created March 8, 2017 11:48 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

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:

@snowch
snowch / README.md
Last active January 30, 2017 20:28
octave_system_of_linear_equations_xyz_plot

For this equation:

x + y + z = 1
2x - y + 3z = 4

Setup the axis:

X = linspace(-100,100,10);
Y = linspace(-100,100,10);
[ XX, YY ] = meshgrid(X,Y);
@snowch
snowch / ambari-api
Created December 7, 2016 21:04 — forked from glinmac/ambari-api
ambari api examples
#!/bin/sh
AMBARI_USER=admin
AMBARI_PASSWORD=
CLUSTER_NAME=sandbox
AMBARI_API=http://127.0.0.1:8080/api/v1/clusters/$CLUSTER_NAME
BLUEPRINT_API=http://127.0.0.1:8080/api/v1/blueprints
hostname="hostname.example.com"
service="aservice"
@snowch
snowch / DSUR datafiles
Last active July 17, 2016 15:50
DSUR scripts
dir.create('./DSUR/')
download.file('https://studysites.uk.sagepub.com/dsur/study/DSUR%20Data%20Files/Data%20files.zip', dest='DataFiles.zip')
unzip('DataFiles.zip', exdir='./DSUR/')
baseurl = 'https://studysites.uk.sagepub.com/dsur/study/DSUR%20R%20Script%20Files/'
scripts <- c(
'Chapter%203%20The%20R%20Environment.R',
'Chapter%204%20DSUR%20Graphs.R',
'Chapter%205%20DSUS%20Exploring%20Data.R',
'Chapter%206%20DSUR%20Correlations.R'
@snowch
snowch / design_doc_replication_backup.py
Last active March 15, 2016 08:42
Replicate design docs for all databases in a Cloudant account
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
@snowch
snowch / Vagrantfile
Created September 27, 2015 12:47
Vagrant Openstack Provider
```
require 'vagrant-openstack-provider'
Vagrant.configure('2') do |config|
config.vm.box = 'openstack'
config.ssh.username = 'ibmcloud'
config.vm.provider :openstack do |os|
os.openstack_auth_url = 'https://keystone2.open.ibmcloud.com/v2.0/tokens'
@snowch
snowch / lisp.c
Last active August 29, 2015 14:26 — forked from sanxiyn/lisp.c
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@snowch
snowch / .xbindkeysrc
Last active August 29, 2015 14:23
Ubuntu MacBook
# ~/.xbindkeysrc
# CTL + ALT + Click = Right Click Menu
"sleep .04 && xdotool click 3"
Control+Alt + Alt_L + b:1 + Release
@snowch
snowch / main.py
Last active December 26, 2016 08:39
Cloudant Python connection pooling and cookie renewal (Gunicorn)
# WARNING: THIS CODE HAS NOT BEEN TESTED!
from apscheduler.scheduler import Scheduler
from requests.adapters import HTTPAdapter
import cloudant
import logging
import json
import os
# setup connection pooling - see http://stackoverflow.com/questions/29046503/cloudant-python-https-connection-pooling