Skip to content

Instantly share code, notes, and snippets.

View troyscott's full-sized avatar

Troy Scott troyscott

View GitHub Profile
@troyscott
troyscott / rss_to_dict.py
Created January 29, 2012 09:26
Convert a rss feed to a python dictionary
import xml.etree import ElementTree
# For example create doc using ElmentTree
# ElementTree.fromstring(xml)
def rss_to__dict(doc):
# Create a Dictionary to store the data
# from the rss feed (xml)
rss = {"rss":[]}
@troyscott
troyscott / jquery-template.html
Created February 4, 2012 19:10
jQuery Template
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>jQuery Template</title>
</head>
<body>
<p></p>
<!--
@troyscott
troyscott / byobu_notify.py
Created February 5, 2012 04:20
byobu custom notification script
#!/usr/bin/env python
#
# example of a byobu custom notification script
# place the file in $HOME/.byobu/bin
# make sure the script is executable (chmod +x)
# displays the kernel version
# every 10 seconds (NN_name where NN is the number of seconds)
import os
import sys
@troyscott
troyscott / extract_lines_to_file.sh
Created February 17, 2012 08:22
Extract lines from file using sed script
#!/usr/bin/env bash
# h,f represent repeating content that could be
# required in multiple files.
h="1,15p"
f="122,125p"
sed -n "$h;44,56p;$f" index.html > last_hour_m1-page.html
@troyscott
troyscott / .vimrc
Created May 5, 2012 09:24
vimrc file for iSSH - iPad 2 Configuration
if &term == "xterm-ipad"
imap jj <Esc>
endif
@troyscott
troyscott / node-express-configuration.js
Created June 1, 2012 01:45
app.configure for the node express module using static files, stylus and routes
var express = require('express'),
stylus = require('stylus'),
routes = require('./routes');
var app = module.exports = express.createServer();
// Configuration
app.configure(function(){
@troyscott
troyscott / mongohq.js
Created June 3, 2012 05:57 — forked from coderoshi/mongohq.js
MongoHQ NodeJS Connection
// npm install mongodb
var mongodb = require('mongodb');
var url = require('url');
var log = console.log;
var connectionUri = url.parse(process.env.MONGOHQ_URL);
var dbName = connectionUri.pathname.replace(/^\//, '');
mongodb.Db.connect(process.env.MONGOHQ_URL, function(error, client) {
if (error) throw error;
@troyscott
troyscott / xmla4js-script.js
Created August 1, 2012 06:03
XMLA 4 JavaScript Example
var query = "select {[Measures].[Sales Amount], " +
"[Measures].[Average Sales Amount]} ON COLUMNS, " +
"[Product].[All Products].Children ON ROWS" +
" From [Sales Summary]";
var rowset = function(mdx){
xmla = new Xmla();
return xmla.execute({
async: false,
url: "http://localhost/olap/msmdpump.dll",
git svn clone --prefix=svn/ --stdlayout \
--authors-file=authors.txt \
--no-minimize-url http://plugins.svn.wordpress.org/tweet/
@troyscott
troyscott / lou.py
Created October 6, 2012 18:21
Lord of Ultima Python Script
#!/usr/bin/env python
import httplib2
from urllib import urlencode
import json
url_login = "https://www.lordofultima.com/en/user/login"
url_main = "http://prodgame05.lordofultima.com/197/"
url_game = "%sindex.asp" % (url_main)
url_ajax = "%sPresentation/Service.svc/ajaxEndpoint/" % (url_main)