Skip to content

Instantly share code, notes, and snippets.

View atomicules's full-sized avatar

atomicules atomicules

View GitHub Profile
@atomicules
atomicules / faster_use_of_data_table.r
Created October 9, 2011 13:27
Using data.table in R and taking the DT[J("a")] example at face value I ended up with a really slow function.
duplicates.step2$days.between <- sapply(
1:nrow(duplicates.step2),
function(q) {
step2id <- as.character(duplicates.step2.dt[,id][q]) #as.character is important bit!
temp <- min(
difftime(
duplicates.step2.dt[, Date][q],
step1.dt[step2id]$Date, #No need to crazily create another data.table
units=c("days")
)
@atomicules
atomicules / ip-specific-extract.vim
Created September 2, 2011 22:29
Extracts/examples from my .vimrc to make settings conditionally based on OS and network
"IP Address specific
"-------------------
"(i.e. Home or Work)
if ip == -1
"Set proxies, Python urllib2 (TwitVim, Simplenote.vim) will automatically pick
"these up
let $http_proxy = 'http://<username>:<password>@<proxy-url>:<proxy-port>'
let $https_proxy = 'http://<username>:<password>@<proxy-url>:<proxy-port>'
endif
import urllib
import urllib2
import base64
import json
snuser = ""
snpassword = ""
proxyurl = "<proxy url>:<proxy port>"
proxylogin = "<proxy username>:<proxy password>"
@atomicules
atomicules / Smile.coffee
Last active September 26, 2015 06:27
Coffeescript source code for a bookmarklet to generate QIF files for SMILE bank.
#Bookmarklet to generate QIF for Recent Item and Previous Statement pages on SMILE.co.uk bank
#Will (try to) open a new popup window where you will have to either:
#a) Copy text from and paste to text editor (Chrome)
#b) Save the page as a text file (Firefox)
#
#Written in Coffescript, but just use http://javascriptcompressor.com/ to compress the
#compiled javascript so you have a bookmarklet.
data = document.getElementsByClassName("summaryTable")[0].children[1].children
@atomicules
atomicules / bookmark-bar-icons.css
Created May 14, 2011 23:47
Firefox 4 Customisation Notes
/*
Bookmark bar icons, used on OSX and Windows XP
Because I do not understand why Firefox tries to emulate Safari on OSX.
I want the exact opposite: Icons and no text.
This also fixes the default circular hover.
*/
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#personal-bookmarks toolbarbutton {
/*This for Windows*/
@atomicules
atomicules / gist:955471
Created May 4, 2011 16:01
An Applescript for Camino to Save Tabs to Pinboard. Doesn't work though because of Gecko 1.9 preflighting the request.
--Camino Pinboard save tabs
-- An Applescript to Save Open Tabs to Pinboard, using the Save Tabs functionality:
-- http://blog.pinboard.in/2011/04/new_save_tabs_feature/
-- Uses francois2metz fake html5-FormData since Gecko 1.9 doesn't have this
-- https://github.com/francois2metz/html5-formdata
-- BUT DOESN'T BLOODY WELL WORK BECAUSE OF A RESTRICTION IN GECKO 1.9
-- Gecko 1.9 preflights all requests except from text/plain which screws the whole thing up
-- (https://developer.mozilla.org/en/http_access_control#Preflighted_requests)
-- Oh well, it was a nice idea.
@atomicules
atomicules / pinboard2camino.rb
Created April 21, 2011 10:03
Pinboard to Camino bookmark importer DON'T USE THOUGH - IT'S RUBBISH!
# Pinboard to Camino
#
# A Ruby script to import/update Pinboard bookmarks into Camino
# This is a evolution of this Applescript: https://gist.github.com/835932 which simply deleted and
# replaced a bookmarks collection. This Ruby script attempts to update, rather than delete and replace,
# so Camino bookmark visit counts are preserved, etc.
#
# IT IS VERY SLOW!
#
# Really, it is. Took about 35 mins to run through a Camino bookmarks file with 2003 existing "pinboard"
@atomicules
atomicules / selection_sort.hs
Created April 11, 2011 23:35
Selection Sort in Haskell the hard (but easier for me) way.
-- Selection Sort in Haskell
--
-- Cheating by using IORef for mutable variables since I don't know what I'm doing
-- with Haskell, although do have an inkling that the benefit of Haskell is that
-- all of below can be done in about three lines.
--
-- Assumes integer input only.
import Data.IORef
import Data.List.Split -- cabal install split
@atomicules
atomicules / i5m_FCE_counter.fxscript
Created March 28, 2011 09:28
FXScript Counter plugin for Apple's Final Cut Express. Note that this information is probably out of date. It is being added here for reference/archival purposes and relates to a blog post from 2005
// To install this plugin simply place in your FCE plugins directory in your home folder
// In FCE 3 this is:
// ~/Library/Preferences/Final Cut Express User Data/Plugins
//
// All my notes and comments are included
//
// With inspiration from and thanks to:
// http://www.joesfilters.com/
// http://www.mattias.nu/plugins/
//
@atomicules
atomicules / PieroFi5m_FCE_timecode_display.fxscript
Created March 28, 2011 09:04
FCE Timecode Display Plugin. Note that this information is probably out of date. It is being added here for reference/archival purposes and relates to a blog post from 2005
// FCE Timecode Display - by PieroF and i5m - v3.0.1 - 01-Feb-2005
//
// LICENSCE
// ========
//
// This plugin is freeware. Do what the hell you want with it.
//
// CONTACT
// =======
//