Skip to content

Instantly share code, notes, and snippets.

View ampledata's full-sized avatar

Greg Albrecht W2GMD ampledata

View GitHub Profile
[tweet]
TIME_PREFIX = "created_at":
REPORT-tweet=json_kv
[json_kv]
DELIMS = ",",":"
#REGEX = \"([^\"]+)\"\:\"([^\"]+)\"
#FORMAT= $1::$2
#MV_ADD=true
#REPEAT_MATCH=true
@ampledata
ampledata / gist:756753
Created December 28, 2010 01:04
this is a workaround for the "You don't exist, go away!" error on darwin
/usr/X11/bin/sessreg -w /var/run/utmpx -a $USER
@ampledata
ampledata / inline editing with ed
Created February 7, 2011 22:44
i want to have the same thing for dinner
# pack lunch
echo "i like tacos" > lunch.txt
# pack dinner
echo "i like burritos" > dinner.txt
# generate ed-style diff
diff -e dinner.txt lunch.txt > order.ed
# add a write to the end of the diff
#include <string.h>
#include <stdio.h>
#include "handler.h"
void handle_request(int sockfd, const char *request)
{
int i;
int b;
char path[16];
@ampledata
ampledata / cloudkick-update_status.rb
Created March 23, 2011 23:37
Cloudkick 'check' status update script in a few lines of ruby.
require 'rubygems'
require 'oauth'
require 'openssl'
# your OAuth consumer credentials.
# https://support.cloudkick.com/API/Authentication#Generating_OAuth_Consumers
CONSUMER_KEY = 'xxx'
CONSUMER_SECRET = 'yyy'
node_id='n359b40753' # your node_id
require 'rubygems'
require 'cloudkick'
require 'json'
require 'timeout'
module MC
class CloudkickHandler < Chef::Handler
CHECK_NAME = 'chef-clientRun'
TIMEOUT = 10
[Wed, 01 Jun 2011 15:27:09 -0700] INFO: *** Chef 0.10.0 ***
[Wed, 01 Jun 2011 15:27:10 -0700] DEBUG: Building node object for jupiter.splunk.com
[Wed, 01 Jun 2011 15:27:10 -0700] DEBUG: Extracting run list from JSON attributes provided on command line
[Wed, 01 Jun 2011 15:27:10 -0700] INFO: Setting the run_list to ["recipe[git]"] from JSON
[Wed, 01 Jun 2011 15:27:10 -0700] DEBUG: Applying attributes from json file
[Wed, 01 Jun 2011 15:27:10 -0700] DEBUG: Platform is mac_os_x version 10.6.7
[Wed, 01 Jun 2011 15:27:10 -0700] INFO: Run List is [recipe[git]]
[Wed, 01 Jun 2011 15:27:10 -0700] INFO: Run List expands to [git]
[Wed, 01 Jun 2011 15:27:10 -0700] INFO: Starting Chef Run for jupiter.splunk.com
[Wed, 01 Jun 2011 15:27:10 -0700] DEBUG: No chefignore file found at /Users/gba/src/chef/cookbooks/chefignore no files will be ignored
require 'rubygems'
require 'dynect_rest'
res = 'i-8bd180e5.example.com'
dyn = DynectRest.new("example", "me", "xxx", "example.com")
DynectRest::Resource.new(dyn, 'CNAMERecord', 'example.com').get(res)
@ampledata
ampledata / gist:1182528
Created August 31, 2011 00:36
for loop shortcut
for k in id_rsa test.pem; do
chmod 0400 $k
ssh-add $k
done