Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / Create Event from Task\cmE.scpt
Created April 1, 2012 18:30
Outlook for Mac AppleScript to create an event from a task
(*
Create Event from Task
Copyright (c) Microsoft Corporation. All rights reserved.
Modified by William Smith.
*)
tell application "Microsoft Outlook"
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dahernan
dahernan / increase_pom.groovy
Created April 24, 2012 09:19
Groovy XML pom manipulation
/*
Script to increase the version number of the project and remove snapshots
Using Gmaven: http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code
Execute standalone
$ mvn groovy:execute
<plugin>
<groupId>org.codehaus.gmaven</groupId>
@twasink
twasink / Description
Created June 6, 2012 11:55
Spring, Hibernate, HSQLDB and automatically creating tables
An example of using Spring and Hibernate together to automatically create a HSQLDB in-memory database for testing hibernate mappings.
@hopsoft
hopsoft / readme2ghpage.rb
Created June 21, 2012 17:09
Convert your README.md on master to index.md on gh-pages
#!/usr/bin/env ruby
# checkout the readme from the master branch
`git checkout gh-pages; git checkout master README.md`
path = `pwd`.gsub(/\n/, "")
readme_path = File.join(path, "README.md")
index_path = File.join(path, "index.md")
# write the index readme file
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@alvinj
alvinj / sbtmkdirs.sh
Last active June 22, 2024 15:13
A shell script to create an SBT project directory structure
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Version: 1.5
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@henrik
henrik / _USAGE.md
Created September 1, 2012 18:56
Run some JS in Chrome from the command line and get the return value. Useful for scrapers that require JS and perhaps a session that's tricky to set up otherwise.

This AppleScript opens a page in Chrome (where you presumably have a logged-in session if required), opens the passed-in URL, runs the passed-in JavaScript and returns the JS return value.

Waits for 1 second for the page to load before executing the JS. Optionally, pass in a third argument with the number of seconds to wait.

Examples:

osascript js_in_chrome.scpt "http://google.com" "document.title"

When logged in.

@eranrund
eranrund / r.py
Created September 7, 2012 12:08
requests debugging
import socket,traceback
orig_socket = socket.socket
class wrap_socket(orig_socket):
def __init__(self, *args, **kwargs):
orig_socket.__init__(self, *args, **kwargs)
#traceback.print_stack()
print '--> new sock', self.fileno()
print
@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"