Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View appastair's full-sized avatar
😷

Alastair Gifillan appastair

😷
View GitHub Profile
@appastair
appastair / alastair.min.js
Created November 27, 2014 23:42
IE6 Polyfill
/* alastair.min.js released under the MIT licence. */
var undefined,console,window,JSON,$;
@appastair
appastair / youtube-dl.sh
Created November 23, 2012 10:00
YouTube Batch Video Downloader Script
#!bin/bash
# Requires: youtube-dl (apt-get install)
# Usage: youtube-dl.sh < video-links.lst
while read line
do
youtube-dl $line --max-quality -t --write-info-json
done
@appastair
appastair / status.sh
Created February 26, 2013 02:47
Bash HTTP Status
xargs curl -sw "%{url_effective},%{http_code},%{redirect_url}\\n" < urls.lst > urls.csv
@appastair
appastair / crontab.sh
Created April 6, 2013 16:26
Automated Torrents with Bash, RTorrent and RSS Torrent Feeds
@hourly "sh ~/torrent-feeds.sh" # add this line by editing your cron jobs ("crontab -e")
@appastair
appastair / mobile-numbers.php
Created April 6, 2013 17:23
Generate Australian Phone Number Lists
<?php
/* Number Prefix Source: http://en.wikipedia.org/wiki/Telephone_numbers_in_Australia#Mobile_phone_numbers_.2804.29 */
$mobile_prefixes = array('0400', '0401', '0402', '0403', '0404', '0405', '0406', '0407', '0408', '0409', '0410', '0411', '0412', '0413', '0414', '0415', '0416', '0417', '0418', '0419', '0420', '0421', '0422', '0423', '0424', '0425', '0427', '0428', '0429', '0430', '0431', '0432', '0433', '0434', '0435', '0437', '0438', '0439', '0440', '0446', '0447', '0448', '0449', '0488', '0450', '0451');
foreach($mobile_prefixes as $mobile_prefix){
for($number = 0; strlen($number) < 7; ++$number){
echo $mobile_prefix.str_pad($number, 6, '0', STR_PAD_LEFT)."\n";
}
}
?>
@appastair
appastair / thumbnails.less
Created June 6, 2013 17:20
Twitter Bootstrap Responsive Thumbnails (2.3.2)
//
// Thumbnails
// --------------------------------------------------
// Note: `.thumbnails` and `.thumbnails > li` are overriden in responsive files
// Make wrapper ul behave like the grid
.thumbnails {
margin-left: -@gridGutterWidth;
@appastair
appastair / footer.php
Last active December 27, 2015 00:29
PHP Page Generation Time
@appastair
appastair / engine.js
Last active January 4, 2016 00:29
HTML5 localStorage AJAX Cache
function getTime(){
return ((new Date().valueOf() * 0.001)|0);
}
function cacheTime(key,time){
/* @TODO: Compare client/server cache ages! */
if((!window.localStorage.getItem('cache-ttl')) || !window.localStorage.getItem('cache-ttl').match(/(\{).+(\})/)){
var cacheTTL = {};
}
else{
@appastair
appastair / timelapse.sh
Created November 3, 2017 04:12 — forked from Aramgutang/timelapse.sh
A Bash script to take regular screenshots of the Ingress Intel map for creating timelapses of operations.
#!/usr/bin/env bash
while [ 1 ]; do
# The --password-store=basic is there to avoid the KDE Wallet access
# request dialog on start-up.
google-chrome --password-store=basic --app=http://www.ingress.com/intel?ll=-33.781201,150.619812\&z=10 &
# Get the process ID, so we can kill it later
chrome_pid=$!
sleep 3
# Get the X window ID of the process we just started so we can resize it.
@appastair
appastair / multi-passcode.user.js
Last active August 8, 2018 13:34 — forked from rongself/multi-passcode.user.js
iitc script for multi passcode apply (点击下面raw按钮安装)
// ==UserScript==
// @id iitc-plugin-multi-passcode@rongself
// @name IITC plugin: Multi Passcode Redeem
// @category Controls
// @version 0.1.0.20180529.1331.
// @namespace https://gist.github.com/rongself/288ad6c887ffb184b469ae0295acc642
// @updateURL https://gist.github.com/appastair/bd32ac0bbfed9a476edd0d2c2148d25e
// @downloadURL https://gist.github.com/appastair/bd32ac0bbfed9a476edd0d2c2148d25e
// @description [rongself-2016-07-17-154202] script for multi passcode apply [appastair-2018-05-28.1331] fixed and added support for newline
// @include https://*.ingress.com/intel*