Skip to content

Instantly share code, notes, and snippets.

@dhinus
dhinus / youtube360check.js
Created March 14, 2016 13:26
Check if browser supports Youtube 360 video
function browserSupports360 () {
// YouTube supports 360 videos in a limited set of browsers,
// see https://support.google.com/youtube/answer/6178631
var ua = navigator.userAgent;
// No mobile browser is supported at the moment
if (/Mobile/.test(ua) || /Tablet/.test(ua)) return false;
// Chrome >= 40
@dhinus
dhinus / keep-calm-and-run-a-bash-script.sh
Created January 12, 2016 17:06
Installing Dokku on AWS Ubuntu
#!/bin/bash
set -e # Exit on errors
# Docker
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
# Dokku
wget -nv -O - https://packagecloud.io/gpg.key | sudo apt-key add -
@dhinus
dhinus / ticket-notifier.sh
Last active September 1, 2015 23:17
Ticket notifier
#!/bin/bash
URL='http://tickets.southbankcentre.co.uk/production/bookingwidget/91964'
REGEX='<form'
INTERVAL=60
while true; do
TKTS=$(curl -s $URL)
if [[ $TKTS =~ $REGEX ]]; then
RES='TKTS!!!!1!!1! '$(date)
terminal-notifier -message "$RES"
else
@dhinus
dhinus / keybase.md
Created August 5, 2015 12:08
Keybase.io proof

Keybase proof

I hereby claim:

  • I am dhinus on github.
  • I am dhinus (https://keybase.io/dhinus) on keybase.
  • I have a public key whose fingerprint is B42F 31A1 6100 2E25 E9A4 0F4B F8D3 7D4B EF15 496A

To claim this, I am signing this object:

@dhinus
dhinus / purge_old_kernels.sh
Created March 12, 2012 10:22
Remove old kernels - Ubuntu
# http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
@dhinus
dhinus / flac2mp3.rb
Created February 22, 2012 10:08 — forked from mxcl/flac2mp3.md
Simplest functional FLAC to MP3 converter script you can make
#!/usr/bin/env ruby
# http://gist.github.com/gists/2998853/
# Forked from http://gist.github.com/gists/124242
filename, quality = ARGV[0], ARGV[1]
abort "Usage: flac2mp3 FLACFILE [V2|V1|V0|320]\nDefault (and recommended) quality is V0." if filename.nil?
qualarg = case quality
when "V0","V1","V2" then quality
when "320" then "b 320"
@dhinus
dhinus / applemail_to_opml.bash
Created May 18, 2011 07:33
Export Apple Mail RSS feeds to opml
#!/bin/bash
#
# Script to export Mail RSS subscriptions to an OPML file.
# Written by VividVisions.com
# http://www.vividvisions.com/2008/02/22/rss-subscriptions-aus-apple-mail-exportieren/
#
# Modified by Francesco Negri
# https://github.com/dhinus
IFS=$'\n'