Skip to content

Instantly share code, notes, and snippets.

@byteface
byteface / gist:2bee00cf19e439b9db03
Created September 9, 2015 01:17
hilight non ascii regex in sublime
do find. click on the regex button. paste this...
[^\x00-\x7F]
# LOGGING ------------------
# log to output file
log(){
message=$( echo `date +%T` - $1 )
echo $message >> 'json/'$LOGFILE
}
# create a log file
LOGFILE=$( echo `date +%F_%T`.log )
bash profile addition to pass messages to slack
function slack()
{
join="{ \"username\": \"mike\", \"text\": \""$@"\" , \"icon_emoji\": \":ghost:\"}"
curl -X POST --data-urlencode "payload=$join" https://hooks.slack.com/services/YOUR/PRIVATE/CODE
}
@byteface
byteface / docker
Created June 12, 2015 01:18
docker stuff
#remove ones not using
docker ps -a | grep "salttest" | awk '{print $1}' | xargs docker rm
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
i pulled an ubuntu12/nginx container with docker.
install a bunch of stuff...
sudo apt-get update
sudo apt-get -y install build-essential
sudo apt-get install xvfb
sudo apt-get install xfs xfonts-scalable xfonts-100dpi
sudo apt-get install libgl1-mesa-dri
sudo apt-get install subversion libqt4-webkit libqt4-dev g++
@byteface
byteface / gist:a260ab5cfd24b0291bac
Created April 9, 2015 06:59
url xpath into google doc cell
// scrape web data into google doc cell with formulas.
i.e
= IMPORTXML("http://en.wikipedia.org/wiki/Test_cricket","//html")
takes an xpath right into neigbouring cell. could be useful.
# gets everything for a single page...
wget -E -H -k -K -p http://www.site.com.au/path/topage
# gets the whole site...
wget -r -p -U wget -r -p -U Mozilla http://www.site.com.au
@byteface
byteface / gist:acc19c7ee880f8b83a31
Created March 15, 2015 22:46
import jquery into console from a CDN.
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
@byteface
byteface / gist:0898aa5714465c350331
Created March 11, 2015 00:20
load a google doc
// get google. js/jsapi.js
// go to doc. create spreasheet. publish it.
var docKey = '';
var url = 'http://spreadsheets.google.com/feeds/list/' + docKey +'/od6/public/values?alt=json';
$(document).ready(function(){
google.load('feeds', '1', { 'callback' : function(){
($.getJSON(url, 'callback=?')).success(function(data){
$(data.feed.entry).each(function(i,entry){