Skip to content

Instantly share code, notes, and snippets.

View atomicules's full-sized avatar

atomicules atomicules

View GitHub Profile
@atomicules
atomicules / bad.R
Created November 20, 2011 14:05
R and data.table for loop bug/nuance. Code extract for embedding in a blog post
#Extract of R code
#This doesn't work properly
#Need to know how many levels
nl <- length(levels(datatable$Grouping))
#then how many per graph
ng = 8
#Can then loop
for (i in 1:ceiling(nl/ng)) {
@atomicules
atomicules / libreimport.py
Created June 3, 2012 09:37
http://gitorious.org/fmthings/lasttolibre/blobs/master/libreimport.py Record of slight tweaks I've made to this to use the scrobble.log format
#!/usr/bin/python
#modified version of old import.py
# Lastscrape -- recovers data from libre.fm
# Copyright (C) 2009 Free Software Foundation, Inc
#
# 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 3 of the License, or
@atomicules
atomicules / gist:3487173
Created August 27, 2012 10:16
Diff file for patching and building STFL 0.22 on OSX 10.5.8 PPC
diff -crB stfl-0.22-orig/Makefile stfl-0.22/Makefile
*** stfl-0.22-orig/Makefile 2012-08-27 10:41:35.000000000 +0100
--- stfl-0.22/Makefile 2012-08-27 10:59:33.000000000 +0100
***************
*** 20,33 ****
include Makefile.cfg
- export CC = gcc -pthread
export CFLAGS += -I. -Wall -Os -ggdb -D_GNU_SOURCE -fPIC
@atomicules
atomicules / snownews.patch
Created March 3, 2013 23:38
Small patch to snownews keybindings to provide more mutt like behaviour. Space does Enter in list view, but next page in reading view. You need to set appropriate user keybindings in conjunction with this patch.
---
interface.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/interface.c b/interface.c
index 6b28a51..78ca3c2 100644
--- a/interface.c
+++ b/interface.c
@@ -289,7 +289,7 @@ void UIDisplayItem (struct newsitem * current_item, struct feed * current_feed,
@atomicules
atomicules / gist:5391599
Created April 15, 2013 21:55
An old half-finished Applescript where I was looking at automating a download of my pinboard bookmarks into Camino. Been quite a while since I used Camino - dated 2011.
-- pinboard username and password
property pbuser : ""
property pbpass : ""
--Download bookmarks via curl to desktop (because can use shortcut when selecting file for import via UI scripting)
do shell script ("cd ~/Desktop; curl https://" & pbuser & ":" & pbpass & "@pinboard.in/export/ -o pinboard.html")
--import bookmarks via UI scripting
tell application "System Events"
diff --git a/sic.c b/sic.c
index d93c2ec..bc09eee 100644
--- a/sic.c
+++ b/sic.c
@@ -118,7 +118,7 @@ parsesrv(char *cmd) {
par = skip(cmd, ' ');
txt = skip(par, ':');
trim(par);
- if(!strcmp("PONG", cmd))
+ if(!strcmp("PONG", cmd) || !strcmp("QUIT", cmd) || !strcmp("JOIN", cmd))
@atomicules
atomicules / TTYtter.pl
Last active August 29, 2015 13:55
Creating diff for TTYtter.pl as of version 2.1.0 (27 December 2012) and version 2.1.0 (14 Jan 2014)
#!/usr/bin/perl -s
#########################################################################
#
# TTYtter v2.1 (c)2007-2012 cameron kaiser (and contributors).
# all rights reserved.
# http://www.floodgap.com/software/ttytter/
#
# distributed under the floodgap free software license
# http://www.floodgap.com/software/ffsl/
#
@atomicules
atomicules / config.h.patch
Created May 21, 2014 12:44
Patches for Snownews to add simplistic undo for "mark all read"
$NetBSD$
--- config.h.orig 2009-09-17 06:44:28.000000000 +0000
+++ config.h
@@ -61,6 +61,7 @@ struct newsitem {
struct newsdata {
struct feed *parent;
int readstatus; /* 0: unread, 1: read */
+ int prevreadstatus; /* 0: unread, 1: read */
char *title;
@atomicules
atomicules / atom2rss.xsl
Last active August 29, 2015 14:01
My slight modification (as rev 2 of this gist) to the atom2rss.xsl file from here: https://kiza.eu/software/snownews/snowscripts/extensions/script/atom2rss/
<?xml version="1.0"?>
<!-- Atom to RSS 1.0 Transformation, written by Rene Puls (rpuls@kcore.de) -->
<!-- Snownews filter command for this extension: "xsltproc /path/to/atom2rss -" -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@atomicules
atomicules / tw-13-2014-11-11.patch
Last active December 19, 2015 18:31
Patch for TW-13 in Taskwarrior
$ Patch for daylight savings time
--- src/recur.cpp.orig
+++ src/recur.cpp
@@ -215,6 +215,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period)
int m = current.month ();
int d = current.day ();
int y = current.year ();
+ ISO8601d recurrence_date;
// Some periods are difficult, because they can be vague.