Skip to content

Instantly share code, notes, and snippets.

@x2q
x2q / wordpress_importer.rb
Created March 18, 2012 00:46 — forked from stammy/wordpress_importer.rb
Import a WordPress database and generate markdown files for Jekyll
# based on the import script by icebreaker, which is based on mojombo's
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# https://gist.github.com/303570
# edited to rewrite image URLs to use my CloudFront URL
require 'rubygems'
require 'sequel'
require 'fileutils'
# $ export DB=my_wpdb
@x2q
x2q / ping_atftp.sh
Created September 19, 2012 08:12
Simple script to ping and then atftp a firmware image e.g. openwrt or dd-wrt
#!/bin/bash
# Simple script to ping and then atftp a firmware image
# Works on my machine and an ASUS WL-500g series router
# Usage: ./ping_atftp 192.168.1.1 openwrt-brcm47xx-squashfs.trx
EXPECTED_ARGS=2
if [ $# -ne $EXPECTED_ARGS ]; then
echo "Usage: `basename $0` ip-addr firmware-image"
exit 1;
fi
@x2q
x2q / nets-psip.xml
Created October 9, 2012 07:11
PBS/Nets (Teller) jPOS ISO Bridge Settings
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager SYSTEM "genericpackager.dtd">
<!-- NETS Single Message field descriptions for GenericPackager -->
<isopackager>
<isofield
id="0"
length="4"
name="MESSAGE TYPE INDICATOR"
@x2q
x2q / SPIII-Current-Cost.sh
Created October 11, 2012 14:39
First attempt to fetch data from a SPIII solar controller and My Current Cost and post the data to emoncms.org
#!/bin/bash
# Crontab
# # m h dom mon dow command
# */1 * * * * /home/raspberrypi/SPIII-Current-Cost.sh
function update {
data=`curl -s --request GET --header "X-ApiKey: <api-key>" \
http://api.cosm.com/v2/feeds/<feed-id>.csv | awk -F "\"*,\"*" '{print "el-"$1":"$3}' | tr '\n' ','`
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d @json.txt https://pay.jumio.com/api/netverify/v1/performNetverify
@x2q
x2q / cpuinfo
Created October 15, 2012 14:14
Linux/Ubuntu 12.10 on a Packard Bell EasyNote (ML61)
processor : 0
vendor_id : AuthenticAMD
cpu family : 17
model : 3
model name : AMD Athlon(tm) X2 Dual-Core QL-64
stepping : 1
microcode : 0x2000032
cpu MHz : 1050.000
cache size : 512 KB
physical id : 0
@x2q
x2q / dmesg
Created October 15, 2012 13:46
Linux/Ubuntu 12.10 on a HP Pavilion dv9000 (dv9780eo)
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 (Ubuntu 3.5.0-17.28-generic 3.5.5)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.5.0-17-generic root=UUID=b4054db7-5b94-4218-a01d-9938f4255bf6 ro quiet splash
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable
-i
-X POST
-u 1a833e2f5e5f4a0abf0e8b4a5cced746:
-d "amount=100"
-d "currency=EUR"
-d "ip=1.1.1.1"
-d "card[number]=4111111111111111"
-d "card[expire_month]=12"
-d "card[expire_year]=2020"
-d "card[cvc]=000"
@x2q
x2q / gist
Created December 7, 2012 20:36
#!/usr/bin/env ruby
# encoding: utf-8
#
# This file, gist, is generated code.
# Please DO NOT EDIT or send patches for it.
#
# Please take a look at the source from
# http://github.com/defunkt/gist
# and submit patches against the individual files
# that build gist.
@x2q
x2q / ga.haml
Created December 28, 2012 13:00
Google Analytics Haml
-# Google Analytics Haml
:javascript
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'your Google Analytics tracking ID']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);