Skip to content

Instantly share code, notes, and snippets.

package controllers;
import java.io.*;
import java.util.Map;
import play.Logger;
import play.mvc.*;
public class Application extends Controller {
public static void index() {
public static void receiveMessage() {
// Parse the message details
String to = params.get("to");
String from = params.get("from");
String body = params.get("body");
// LOG the request details
Logger.debug("XMPP Message sent to " + to + " by " + from + " is " + body );
ok();
}
#!/usr/bin/env ruby
require 'rubygems'
require 'vagrant'
Vagrant::Environment.load!
env = Vagrant::Environment.load!(Dir.pwd)
env.require_persisted_vm
sshconn = Vagrant::SSH.new(env)
sshconn.execute do |ssh|
cmd = "cd /tmp/vagrant-chef && sudo chef-solo -c solo.rb -j dna.json"
$.getJSON('http://whereami.lds.li/loc.json?callback=?', function(data) {
var locstr = '';
if (data.city == 'N/A') {
locstr = 'Not Available..';
}
else {
locstr = data.city + ', ' + data.state + ', ' + data.country + '.';
locstr = '<a href="http://maps.google.com/maps?q='+ locstr + '&z=6">' + locstr + '</a>';
}
$('.currentloc').text(locstr);
# Disables spotlight icon in 10.6 - will need to re-run after updates
sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
killall SystemUIServer
desc "deploys to heroku"
task :heroku_deploy do
# create the git repo
`cd #{RAILS_ROOT} && mkdir .heroku_cache && cd .heroku_cache && git init`
# update files
`rsync -a --exclude=config/database.yml --exclude=.svn --exclude=.hg --exclude=.heroku_cache --delete #{RAILS_ROOT}/* #{RAILS_ROOT}/.heroku_cache/ `
# git addremove
`cd #{RAILS_ROOT}/.heroku_cache && git add -A && git ls-files --deleted -z | xargs -0 git rm`
# git commit
`cd #{RAILS_ROOT}/.heroku_cache && git commit -m 'deploy commit'`
require 'rubygems'
require 'open-uri'
require 'mechanize'
require 'pp'
site_dashboard_url = 'http://www.tumblr.com/tumblelog/lstoll'
email = '[email protected]'
password = 'xxxxxx'
agent = WWW::Mechanize.new
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
# Need to have this file in your .emacs.d
# http://github.com/lstoll/emacs.d/blob/lstoll/emacs-gui.sh
# This will open the file in GUI Emacs, starting if if's not running
alias ec="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -a ~/.emacs.d/emacs-gui.sh"
# This will open the file in a new frame in the terminal, using the running gui backend
alias et="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t -a ~/.emacs.d/emacs-gui.sh"
# Open the file in GUI Emacs, in a new frame (OS X 'Window')
@lstoll
lstoll / memcache.js
Created February 23, 2010 15:19 — forked from jespern/memcache.js
var tcp = require('tcp'),
sys = require('sys');
var crlf = "\r\n";
var crlf_len = crlf.length;
var error_replies = ['ERROR', 'NOT_FOUND', 'CLIENT_ERROR', 'SERVER_ERROR'];
var reply_indicators = {
'get' : ['VALUE', 'END'],