Skip to content

Instantly share code, notes, and snippets.

View jaymzcd's full-sized avatar
🍜
Maybe cooking some pad thai

jaymz campbell jaymzcd

🍜
Maybe cooking some pad thai
View GitHub Profile
#!/bin/bash
u=`uptime | awk -F" " '{print $3"d", $6"u"}'`
l=`uptime | awk -F" " '{print $10,$11,$12}'`
h=`hostname`
disk_free=`df -h | head -2 | tail -1 | awk -F" " '{print "/",$5,$4}'`
curl -u YourEmail:YourPassword -d status="`echo $h: disk $disk_free";" users $u";" LA: $l`" http://twitter.com/statuses/update.xml >& /dev/null
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onInit(event);" backgroundColor='0xFFFFFF' width="1100" height="800">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.events.InteractiveScene3DEvent;
#!/bin/bash
# uses imagemagick to stich together all images in a folder and
# then writes a css file with the correct offsets along with a
# test html page for verification that its all good
if [ $# -gt 0 ]
then
if [ $3 ]
#!/bin/bash
OFFSET=1000
DATA=`wget -nv -O - http://$1 2>/dev/null`
LENGTH=${#DATA}
if [ $LENGTH -lt $OFFSET ]
then
echo 'Page returned too view bytes';
#!/bin/bash
input=''
while read data
do
input=${input}${data}
done
echo $input
echo $input > /tmp/ccss.tmp.less
/var/lib/gems/1.9.1/bin/lessc /tmp/ccss.tmp.less /tmp/ccss.css
cat /tmp/ccss.css
#!/bin/bash
# Im sure there is a fancy git way to do this. for now this is what i'm doing to commit
# in two places at the same time... i should really pick up the git book.
cp -r /var/www/vanscom/blogger/ /home/jaymz/Desktop/
cd /home/jaymz/Desktop/blogger/
git add .
git commit -a -m "$1"
git push origin master
#!/bin/bash
android create project --target 1 --name "$1" --path ${1,,} --activity $1 --package eu.jaymz.${1,,}
#!/bin/bash
# Finds all ASP files in the current folder and below and turns the include
# definition into a PHP format one. The converted file is renamed to FILE.php
# and the original file removed. Links in the format 'href="file.asp"' *only*
# are changed to 'href="file.php"'. It then loops through to fix .asp
# links in plain HTML files - this fits my use-case.
for FILE in $(find ./ -name "*.asp")
do
/* Table structure for a wireshark capture file CSV export */
DROP TABLE `scratch`.`packet_log`;
CREATE TABLE `scratch`.`packet_log` (
`packet` INTEGER NOT NULL,
`time` DOUBLE NOT NULL,
`source` varchar(50) NOT NULL,
`destination` varchar(50) NOT NULL,
`protocol` VARCHAR(10) NOT NULL,
`info` VARCHAR(255) NOT NULL,
PRIMARY KEY (`packet`)
@register.tag
def populate_posts(parser, token):
try:
tag_name, num_posts, as_name, name = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError("not enough arguments given")
return PostsNode(num_posts, name)
class PostsNode(template.Node):
def __init__(self, num_posts, name):