Skip to content

Instantly share code, notes, and snippets.

View donfanning's full-sized avatar
🗃️
Holding up libraries and robbing them blind for the future.

Don Fanning donfanning

🗃️
Holding up libraries and robbing them blind for the future.
View GitHub Profile
#! /bin/bash
# Batch Convert Script by StevenTrux
# The Purpose of this Script is to batch convert any video file to mp4 or mkv format for chromecast compatibility
# this script only convert necessary tracks if the video is already
# in H.264 format it won't convert it saving your time!
# Put all video files need to be converted in a folder!
# the name of files must not have " " Space!
# Rename the File if contain space
@donfanning
donfanning / dnsupdate.py
Created August 8, 2016 00:22 — forked from pklaus/dnsupdate.py
dnsupdate is meant to replace nsupdate, the standard DDNS update tool created by BIND authors ISC. While nsupdate does the job it is awkward to wrap in scripts and its usage in general is just not very intuitive. dnsupdate is meant to work well from the command line or from scripts and easy to use. It also does some nice things like automaticall…
#!/usr/bin/env python2.7
# Matt's DNS management tool
# Manage DNS using DDNS features
#
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/
#
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com.
# -h HELP!
# -s the server
# -k the key
@donfanning
donfanning / latency.markdown
Created October 8, 2016 22:31 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

#!/usr/bin/env python
#Copyright (C) 2009 Allen Sanabria
#This program is free software; you can redistribute it and/or modify it under
#the terms of the GNU General Public License as published by the Free Software Foundation;
#either version 2 of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
#without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#See the GNU General Public License for more details. You should have received a copy of i
@donfanning
donfanning / docker-machine-mac-osx.md
Created September 7, 2017 19:38 — forked from Integralist/docker-machine-mac-osx.md
Docker Machine on Mac OS X

VirtualBox

  • https://www.docker.com/toolbox
  • docker-machine create --driver virtualbox dev
  • docker-machine env dev (add values to ~/.zshrc)
    • e.g. echo eval "$(docker-machine env dev)" >> ~/.zshrc
  • docker-machine ls
  • docker ps (might need to re-source .zshrc file; e.g. . ~/.zshrc)
  • docker run hello-world
  • docker-machine ip dev
@donfanning
donfanning / _INSTALL.md
Created December 26, 2017 19:16 — forked from robinsmidsrod/_INSTALL.md
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

var s3 = require('s3');
var AWS = require('aws-sdk');
var async = require('async');
var syncClient = s3.createClient({
maxAsyncS3: 20,
});
tmpDir = "/tmp/sitecopy";
dstBucket = "aemtos3test"
var WebPageTest = require('webpagetest');
var AWS = require('aws-sdk');
var zlib = require('zlib');
AWS.config.update({region:'us-east-1'});
var s3 = new AWS.S3();
var cloudwatch = new AWS.CloudWatch();
@donfanning
donfanning / sitecrawler.js
Created August 15, 2018 12:02 — forked from martinjacobs/sitecrawler.js
Site crawler
var phantom = require('phantom');
var Crawler = require("simplecrawler");
var mycrawler = Crawler.crawl("http://www.example.com/");
mycrawler.maxDepth = 3;
mycrawler.interval = 500;
mycrawler.addFetchCondition(function(parsedURL) {
if (parsedURL.path.match(/\.(css|jpg|pdf|docx|js|png|ico)/i)) {
// console.log("Ignored ",parsedURL.path);
return false;
require_relative "xpath_crawler"
require_relative "parser"
module ShareCrawler
class << self
def get(crawler)
xpath_crawler = XPathCrawler.new(crawler["url"])
parsed = { "warning" => 0 }
parsed["value"] = Parser.parse_value(xpath_crawler.parse(crawler["xpath_value"]))
parsed["date"] = Parser.parse_date(xpath_crawler.parse(crawler["xpath_date"]))