Skip to content

Instantly share code, notes, and snippets.

View KRUI - FFMP3
<!-- BEGINS: AUTO-GENERATED FFMP3 CODE -->
<object width="180" height="60" bgcolor="#FFFFFF">
<param name="movie" value="ffmp3-config.swf" />
<param name="flashvars" value="url=http://remote.krui.fm:8000/listen&lang=en&codec=mp3&volume=100&tracking=true&skin=ffmp3-mcclean.xml&title=KRUI" />
<param name="wmode" value="window" />
<param name="scale" value="noscale" />
<embed src="ffmp3-config.swf" flashvars="url=http://remote.krui.fm:8000/listen&lang=en&codec=mp3&volume=100&tracking=true&skin=ffmp3-mcclean.xml&title=KRUI" width="180" scale="noscale" height="60" wmode="window" bgcolor="#FFFFFF" type="application/x-shockwave-flash" />
</object>
<!-- ENDS: AUTO-GENERATED FFMP3 CODE -->
@fredrick
fredrick / padInt.js
Created Dec 28, 2010
Converts integers such as '1' to strings "01"
View padInt.js
function padInt(number){
if (parseInt(number) < 10){
return "0" + parseInt(number).toString();
} else {
return number.toString();
}
}
@fredrick
fredrick / Graph.js
Created Feb 28, 2011
Example: objects/prototypes in JavaScript
View Graph.js
/*
JavaScript Stream data client and graph renderer
*/
jQuery(document).ready(function() {
function Graph(type) {
/*
Graph class
Override properties to modify graph appearance before invoking the render() method
*/
this.category = type;
@fredrick
fredrick / seat-Object-blender.py
Created Mar 10, 2011
Object instantiation of a data type blender
View seat-Object-blender.py
test = Test(
string='test-554e4b55e8cc57f39f16f335b0a63825',
integer=123,
float=3.14159265,
array=['thing 1', 'thing 2', 'thing 3'],
tuple=('string', 123, 3.14159265),
dictionary={'this 1': 'that 1', 'this 2': 'that 2'},
tuples_in_array=[('string', 123, 3.14159265), ('string', 456, 3.14159265)],
arrays_in_tupple=(['thing 1', 'thing 2', 'thing 3'], ['thing 4', 'thing 5', 'thing 6']),
complex_nested_mixed_data_types=(
@fredrick
fredrick / stub.py
Created Mar 15, 2011
Dynamically define object variables/methods at instantiation (quick mock)
View stub.py
class Stub(object):
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
@fredrick
fredrick / pyinotify-issue2.log
Created Mar 17, 2011
pyinotify event dump, Missing IN_CREATE events
View pyinotify-issue2.log
1300383220 : <Event dir=False mask=0x100 maskname=IN_CREATE name=latest.tar.gz path=/home/fgaloso/test pathname=/home/fgaloso/test/latest.tar.gz wd=1 >
1300383225 : <Event dir=False mask=0x8 maskname=IN_CLOSE_WRITE name=latest.tar.gz path=/home/fgaloso/test pathname=/home/fgaloso/test/latest.tar.gz wd=1 >
1300383241 : <Event dir=True mask=0x40000100 maskname=IN_CREATE|IN_ISDIR name=wordpress path=/home/fgaloso/test pathname=/home/fgaloso/test/wordpress wd=1 >
1300383241 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-rss.php path=/home/fgaloso/test/wordpress pathname=/home/fgaloso/test/wordpress/wp-rss.php wd=2 >
1300383241 : <Event dir=False mask=0x8 maskname=IN_CLOSE_WRITE name=wp-rss.php path=/home/fgaloso/test/wordpress pathname=/home/fgaloso/test/wordpress/wp-rss.php wd=2 >
1300383241 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-blog-header.php path=/home/fgaloso/test/wordpress pathname=/home/fgaloso/test/wordpress/wp-blog-header.php wd=2 >
1300383241 : <Event dir=False mask=0x8 mask
@fredrick
fredrick / async.py
Created Mar 17, 2011
Using Python's multiprocessing module, it's easy to create asynchronous subprocesses
View async.py
#!/usr/bin/env python
# encoding: utf-8
import random
import time
import multiprocessing
if __name__ == '__main__':
"""Demonstration of GIL-friendly asynchronous development with Python's multiprocessing module"""
@fredrick
fredrick / distinct-value-couchdb.js
Created Mar 28, 2011
Way to return unique distinct values by a given key?
View distinct-value-couchdb.js
'key1' => 'somevalue'
'key1' => 'somevalue'
'key2' => 'anotherval'
'key2' => 'andanother'
'key2' => 'andanother'
/*
Way to return unique distinct values by a given key?
For example:
?key="key1" would return ['somevalue']
@fredrick
fredrick / rewalk.py
Created Apr 4, 2011
Example strategy to re-walk files that were not accounted for.
View rewalk.py
import os
import multiprocessing
class Event(object):
"""Mock event type"""
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
@fredrick
fredrick / pyinotify.f4ce646a42b040eb08b0.log
Created Apr 11, 2011
Log file output to test pyinotify commit: f4ce646a42b040eb08b0
View pyinotify.f4ce646a42b040eb08b0.log
1302511080 : <Event dir=True mask=0x40000100 maskname=IN_CREATE|IN_ISDIR name=wordpress path=/gfs/www/stacks/fred.fred pathname=/gfs/www/stacks/fred.fred/wordpress wd=3 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-activate.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-activate.php wd=4 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=license.txt path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/license.txt wd=4 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-pass.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-pass.php wd=4 >
1302511148 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-login.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-login.php wd=4 >
1302511148 : <Event dir=False mask=0x100 maskname=IN_CREATE name=readme.html path=/gfs/www/stacks/fred.fred/wordpre
You can’t perform that action at this time.