Skip to content

Instantly share code, notes, and snippets.

View booyaa's full-sized avatar
🏠
Working from home forevah!

Mark Sta Ana booyaa

🏠
Working from home forevah!
View GitHub Profile
@booyaa
booyaa / wunderground2pachube.php
Created April 25, 2011 16:54
weather underground xml to pachube eeml
<?php
/*
you need a cron job to grab the correct weather underground xml file.
here's what i use:
*/60 * * * * /usr/bin/curl -o /home/booyaa/public_html/boo/yaa/bay/surbiton.wunder.xml http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=ISURREYS1 >/dev/null 2>&1
@booyaa
booyaa / sysinf2pachube.sh
Created April 25, 2011 17:02
sysinfo2pachube
# unix sysinfo 2 pachube eeml
# mark sta. ana (booyaa.org)
# assumptions: this script is running on a vps guest on openvz
# user connected
users=`w | head -1 | awk '{print $6}'`
# get home volume max storage capacity and current usage
homeFree=`df -m | grep '/dev/simfs' | awk '{print $4}'`
homeMax=`df -m | grep '/dev/simfs' | awk '{print $2}'`
@booyaa
booyaa / ArduinoBathroomLight.c
Created April 26, 2011 10:53
Bathroom light Arduino sketch
// button to activate light
/*
* Purpose: Push button activates an LED that slow fades on and after a fixed paused, fades off.
* Change log:
* 20080202: initial release, calling this the first prototype.
* Code taken from:
* Button by DojoDave <http://www.0j0.org> - http://www.arduino.cc/en/Tutorial/Button
* Fading LED // by BARRAGAN <http://people.interaction-ivrea.it/h.barragan>
*/
@booyaa
booyaa / RemoveXMLHeader.xsl
Created August 12, 2011 14:18
Removing XML header from XSLT transformation
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- this is useful for xml files like partial html code -->
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<!-- add the rest of your transformation here... -->
</xsl:stylesheet>
@booyaa
booyaa / xpages-columns.js
Created September 8, 2011 14:49
XPages SSJS code to abbreviate overly long View Column values
// Handy XPages SSJS to help keep columns fixed width by truncating the content, but keeps the full
// text value as a tool tip using the ABBR tag.
// Still learning my way around XPages SSJS so any feedback is welcome
// Usage: 1) create a view variable callde "rowData" (All Props > Data > var)
// 2) set view column props to display as HTML
// 3) add code to data computed value: renderViewColumnDataAsTruncated("ProductDescription",15)
function renderViewColumnDataAsTruncated(columnName, maxLength)
{
//FIXME: there must be a better way of handling viewScope variables...
@booyaa
booyaa / fiddle.css
Created October 21, 2011 17:57 — forked from zalun/fiddle.css
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}
@booyaa
booyaa / gist:1564797
Created January 5, 2012 11:18
markdown parsing
11:16 < booyaa> anyone done markdown parsing?
11:16 < booyaa> i'm looking to read some github md files, ideally want to say...
11:16 < booyaa> md = parseMD('wiki-page.md')
11:17 < booyaa> tableAsObjectLiteral = md.table(0)
11:17 < booyaa> i fear i may need to write this myself.
11:17 < booyaa> everyone seems to be only intersted in parsing frmo md to html
@booyaa
booyaa / NumbersAPI.js
Created March 14, 2012 17:08
get body Request and return as string
var Request = require('request');
//doesn't work var Numbers = Numbers || {};
var Numbers = function() {
// constructor
}
Numbers.prototype = {
baseUrl : 'http://numbersapi.com/'
@booyaa
booyaa / gist:2302601
Created April 4, 2012 15:20
Querying text files in LINQ
void Main()
{
IEnumerable<string> textFile = File.ReadLines(@"C:\leet\users.txt");
var matches = from word in textFile
where word.Substring(0,2) == "FU"
select word;
matches.Dump();
@booyaa
booyaa / gist:3129514
Created July 17, 2012 13:56
/sys/class/leds
$ pwd
/sys/class/leds
$ ls
led0 mmc0::
$ ls -l
total 0
lrwxrwxrwx 1 root root 0 Jan 1 1970 led0 -> ../../devices/platform/leds-gpio/leds/led0
lrwxrwxrwx 1 root root 0 Jan 1 1970 mmc0:: -> ../../devices/platform/leds/mmc0::