Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
#!/usr/bin/python
'parses `svn log` and outputs as one line per commit'
import sys
import re
import datetime
user_filter = None
#!/usr/bin/python
import urllib2
import urllib
import base64
import json
import pprint
def curl(url, username=None, password=None, method='GET', data=None):
'''simple HTTP util. similar to curl
#!/bin/bash
if (( $# < 1 ))
then
echo "Usage: $0 json url [cred, default=admin:admin]"
echo "example: $0 /tmp/content.tidy.-1.json http://localhost:4502/content/copy"
exit 1
fi
j="$1"
#!/bin/bash
if (( $# < 1 ))
then
echo "Usage: $0 bundleId [host default=localhost:4502] [cred default=admin:admin]"
echo "restarts osgi bundle using felix web console."
echo "ex, $0 org.apache.sling.scripting.jsp"
exit 1
fi
#!/bin/bash
if (( $# < 3 ))
then
echo "usage: $0 src-host src-path dest-host [dest-path] [vlt rcp options]"
exit 1
fi
read -s -p "src-cred [default=admin:admin]: " cred1
if [[ -z "$cred1" ]]
@Override
public synchronized void run() {
LOG.debug("start...");
ResourceResolver resolver = null;
Session session = null;
try {
resolver = resolverFactory.getAdministrativeResourceResolver(null);
session = resolver.adaptTo(Session.class);
//do stuff...
@saml
saml / gist:1165067
Created August 23, 2011 13:15 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Day CQ Enterprise Java Content Management System Expert and Adobe Technology Evangelist
Favorite Python project: pypy
Favorite Conference: icfp
Python Experience Level: web scaling in the cloud
@saml
saml / mkevent-config.sh
Created September 9, 2011 11:15
libevent2 mingw needed step
#!/bin/bash
f="include/event2/event-config.h"
echo '/* event2/event-config.h' > $f
echo ' *' >> $f
echo ' * This file was generated by autoconf when libevent was built, and post-' >> $f
echo ' * processed by Libevent so that its macros would have a uniform prefix.' >> $f
echo ' *' >> $f
echo ' * DO NOT EDIT THIS FILE.' >> $f
echo ' *' >> $f
echo ' * Do not rely on macros in this file existing in later versions.'>> $f
#!/bin/bash
if (( $# < 1))
then
echo "Usage: $0 host:port"
echo "example"
echo " $0 localhost:4502 < admin-password.txt"
exit 1
fi
@saml
saml / HelloWorldHttp.hs
Created September 30, 2011 02:37
hello world web server haskell
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network (listenOn, PortID(PortNumber))
import Network.Socket (accept, withSocketsDo, sClose)
import Network.Socket.ByteString (sendAll)
import Control.Concurrent (forkIO)
import qualified Data.ByteString.Lazy.Char8 as LazyByte (toChunks)
import qualified Data.ByteString as WordByte (concat)