Skip to content

Instantly share code, notes, and snippets.

@lancehudson
lancehudson / ffmpeg_monitor.sh
Created April 8, 2016 20:20
This script is created to handle stalled ffmpeg processes
#!/bin/bash
# This script is created to handle stalled ffmpeg processes
PROCESS=ffmpeg
USER=hightail
TIME=+5
#LOGSERVER=local-hightailspaces.com
LOGSERVERPORT=6379
KEY=logstash
KEYTYPE=RPUSH
@lancehudson
lancehudson / phantomjs_monitor.sh
Last active April 8, 2016 20:55
Kill stalled phantomjs processes
#!/bin/bash
# This script is created to handle buggy prerender where phantomjs hangs
PROCESS=phantomjs
LOGSERVER=local-hightailspaces.com
LOGSERVERPORT=6379
KEY=logstash
KEYTYPE=RPUSH
TYPE=phantomjs-monitor
KILL=false
@lancehudson
lancehudson / docker info
Last active February 18, 2016 03:01
docker compose 2.0 options and extends not working
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 1.10.1
Storage Driver: overlay
Backing Filesystem: extfs
Execution Driver: native-0.2
Logging Driver: json-file
@lancehudson
lancehudson / Vagrantfile
Created December 1, 2015 18:58
Docker-Machine with VPN
# -*- mode: ruby -*-
# vi: set ft=ruby :
required_plugins = %w( vagrant-triggers vagrant-persistent-storage )
required_plugins.each do |plugin|
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
end
IP = "192.168.50.4"
NAME = "default"
@lancehudson
lancehudson / reddit.js
Created October 16, 2015 01:47
Top Reddit
var request = require('request');
var getTopItems = function(url, cb) {
request.get(url, function(err, response, body) {
if (err) { return cb(err); }
if (response.statusCode !== 200) { return cb(body); }
cb(null, JSON.parse(body).data.children.map(function(item) {
return item.data;
@lancehudson
lancehudson / .chronos_sync.md
Last active March 1, 2022 15:05
Chronos repo sync hooks

apparently the first alphabetical name is the name of the gist, otherwise this whould be readme.md

prereqs: gem install socksify

do a ./pull.sh at least once into this repo and when you clone it use the flag --recursive

because gists dont allow subdirs, hooks_setup.sh should be hooks/setup.sh go ahead and fix all of those and chmod +x both the pre-* hooks.

and run hooks/setup.sh to set the hooks up

@lancehudson
lancehudson / test.js
Last active August 29, 2015 14:18
Test for PixMOB
var http = require('http');
var app = http.createServer(function(req, res) {
if(req.method === "POST") {
var body = "";
req.on('data', function (chunk) {
body += chunk;
});
req.on('end', function () {
io.emit('pixmob', "on");
#!/bin/bash
brew install dnsmasq
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/dev
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/test
echo -n "nameserver 127.0.0.1" | sudo tee /etc/resolver/docker
@lancehudson
lancehudson / createImage.sh
Last active August 29, 2015 14:16
Script to build Rasp Pi Images for noobs from tar.gz
#!/bin/bash
#URL=http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
URL=$1
wget $URL -O image.tgz
fallocate -l 2G root.img
mkfs.ext4 root.img
mkdir root
mount -t ext4 root.img root
bsdtar -xpf image.tgz -C root
@lancehudson
lancehudson / kubernetes.json
Created January 21, 2015 06:27
CloudFormation script for Kubernetes on CoreOS on EC2
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Kubernetes on EC2",
"Mappings": {
"RegionMap": {
"eu-central-1": {"AMI": "ami-468dbd5b"},
"ap-northeast-1": {"AMI": "ami-0c05160d"},
"sa-east-1": {"AMI": "ami-23b00d3e"},
"ap-southeast-2": {"AMI": "ami-b7295c8d"},
"ap-southeast-1": {"AMI": "ami-b40f27e6"},