Skip to content

Instantly share code, notes, and snippets.

View Kagee's full-sized avatar
👾
Still working from home, what about you?

Anders Einar Hilden Kagee

👾
Still working from home, what about you?
View GitHub Profile
@Kagee
Kagee / gist:6045475
Created July 20, 2013 15:36
Gmvault chokes on & (installed default location)
mode gjenkjennes ikke som en intern eller ekstern kommando,
kjørbart program eller satsvis fil.
Welcome to gmvault (version 1.8.1-beta).
Run gmvault --help to display the help.
Run gmvault {command} --help to display help for specific commands.
gmvault-shell>gmvault --help
Anders gjenkjennes ikke som en intern eller ekstern kommando,
kjørbart program eller satsvis fil.
@Kagee
Kagee / gist:6045470
Last active December 20, 2015 00:59
Gmvault chokes on & (installed in C:/gmvault)
Welcome to gmvault (version 1.8.1-beta).
Run gmvault --help to display the help.
Run gmvault {command} --help to display help for specific commands.
gmvault-shell>gmvault --help
Anders gjenkjennes ikke som en intern eller ekstern kommando,
kjørbart program eller satsvis fil.
usage: gmvault [-h] [-v] {sync,restore,check,export} ...
https://github.com/trinidad/trinidad/wiki/init.d-scripts
#!/bin/sh
set -e
# Must be a valid filename
NAME=trr
#/var/run/app must be writable by your user
PIDFILE=/var/run/app/trr.pid
@Kagee
Kagee / lasttweet.py
Last active December 18, 2015 11:20
Get someone's last tweet using @sixohsix's sweet Python Twitter Tools. Use norep as first argument to drop replies, nort to not count retweets, and any other word as first argument drop both. Then use twitter handle as seconds argument. Use handle as first and only argument to return last tweet, even if it is a reply/rt.
#! /usr/bin/python
import sys
from twitter import *
if len(sys.argv) > 1:
def read_data_file(filename):
f = open(filename)
return f.readline().strip(), f.readline().strip(), f.readline().strip(), f.readline().strip()
handle=sys.argv[1]
exclude_replies=0
hildenae@offle:~/tmp/twitter$ cat kopweb.py
from twitter import *
#oauth_dance("My App Name", CONSUMER_KEY, CONSUMER_SECRET, MY_TWITTER_CREDS)
oauth_token="###############"
oauth_secret="##############"
CONSUMER_KEY="#############"
CONSUMER_SECRET="###########"
# = read_token_file(MY_TWITTER_CREDS)
t = Twitter(auth=OAuth(oauth_token, oauth_secret, CONSUMER_KEY, CONSUMER_SECRET))
@Kagee
Kagee / shows.pl
Created April 21, 2012 02:15
Get list of today's shows from on-my.tv
#! /usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
use XML::XPath;
use XML::XPath::XMLParser;
my $file = 'today.xml';
unlink($file);
diff --git a/perllib/FixMyStreet/Geocode/Google.pm b/perllib/FixMyStreet/Geocode/Google.pm
index 83b36db..b3beccf 100644
--- a/perllib/FixMyStreet/Geocode/Google.pm
+++ b/perllib/FixMyStreet/Geocode/Google.pm
@@ -75,6 +75,10 @@ sub string {
my $address = $_->{address};
next unless $c->cobrand->geocoded_string_check( $address );
( $longitude, $latitude ) = @{ $_->{Point}->{coordinates} };
+ mySociety::Locale::in_gb_locale {
+ $longitude = "$longitude";
@Kagee
Kagee / gist:2032045
Created March 13, 2012 22:01
summarize_binlog.pl
#!/usr/bin/perl
use strict;
use warnings;
if ($#ARGV < 0 ) {
print "usage: $0 <path> [path...]\n";
exit;
}
my $file = $ARGV[0];
# Check that the path exsists, is a file, and is readable
munmap(0xf77a8000, 4096) = 0
stat64("/var/log/apache2/access.log", {st_mode=S_IFREG|0640, st_size=2162990674, ...}) = 0
open("/var/log/apache2/access.log", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0640, st_size=2162990674, ...}) = 0
_llseek(3, 0, [2162990674], SEEK_END) = 0
_llseek(3, 0, [0], SEEK_SET) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
manager:~/scripts# cat foreach_host.sh
for hostname in $(cat /etc/hosts | awk '{print $NF}'); do echo "Working on hostname: $hostname"; $1; done;
manager:~/scripts# ./foreach_host.sh 'nc $hostname 4949'
Working on hostname: manager
$hostname: forward host lookup failed: Unknown host