Skip to content

Instantly share code, notes, and snippets.

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

#!/bin/bash
# Created by Håvard Fossli <hfossli@gmail.com> in 2013
# This is free and unencumbered software released into the public domain.
# For more information, please refer to <http://unlicense.org/>
#
# Description
# A bash script for fetching all branches and tags of a git project as snapshots into separate folders
#
# Keywords
import sqlite3
# open connection and get a cursor
conn = sqlite3.connect(':memory:')
c = conn.cursor()
# create schema for a new table
c.execute('CREATE TABLE IF NOT EXISTS sometable (name, age INTEGER)')
conn.commit()
property myDefaultList : ""
on alfred_script(q)
set qt to q as text
set itemList to extractList(qt)
set expandedQT to expandDelay(expandDay(removeList(qt)))
tell application "Reminders"
activate
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
tell application "Safari"
set _source to do JavaScript "window.document.documentElement.outerHTML" in document 1
set _name to name of document 1
end tell
tell application "BBEdit"
make new text window with properties ¬
{contents:_source, source language:"HTML", name:"Generated source: " & _name}
select insertion point before character 1 of text window 1
tell application "BBEdit"
activate
set old_name to name of text window 1
set dialog_result to display dialog "" default answer (old_name) ¬
buttons {"Cancel", "Rename"} default button 2 ¬
with icon note ¬
with title "Rename Active Document"
if button returned of dialog_result = "Rename" then
set new_name to text returned of dialog_result
set d to active document of text window 1
#!/usr/bin/env ruby
def e_sh(str)
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''")
end
def find_headers(lines)
in_headers = false
lines.each_with_index {|line, i|
if line =~ /^\S[^\:]+\:( .*?)?$/
to make_new_project(project_name)
tell application "Xcode" to activate
tell application "System Events"
tell process "Xcode"
click menu item "New Project…" of menu 1 of menu bar item "File" of menu bar 1
tell window "New Project"
-- row 8 is empty project, 4 is Cocoa App
select row 4 of outline 1 of scroll area 1 of splitter group 1 of group 1
click button "Cocoa Application" of radio group 1 of scroll area 1 of splitter group 1 of splitter group 1 of group 1
activate application "Captive Network Assistant"
tell application "System Events"
tell process "Captive Network Assistant"
tell UI element 1 of scroll area 1 of window "Join “central”"
set value of text field 1 of group 12 to ""
set value of text field 1 of group 14 to ""
click button "Submit" of group 16
end tell
end tell
end tell