Skip to content

Instantly share code, notes, and snippets.

View jkubicek's full-sized avatar

Jim Kubicek jkubicek

View GitHub Profile
@jkubicek
jkubicek / birds.txt
Last active August 29, 2015 14:02
Print the names of all the birds
Striated Pardalote
Elegant Crested Tinamou
Little Tinamou
Slaty-breasted Tinamou
Thicket Tinamou
Great Tinamou
Chilean Tinamou
Cinereous Tinamou
Brown Tinamou
Greater Rhea
tell application "iPhone Simulator"
activate
end tell
tell application "System Events"
tell process "iPhone Simulator"
click menu item "Reset Content and Settings…" of menu "iOS Simulator" of menu bar 1
delay 0.25
key code 76 -- The return button
end tell
@jkubicek
jkubicek / gist:9075340
Created February 18, 2014 17:17
My mogenerator rake task
desc 'Use Mogenerator to create Core Data models'
task :mogen do
`which mogenerator`
unless $?.success?
fail "This project requires mogenerator. See installation instructions"\
" at http://rentzsch.github.io/mogenerator/"
end
cmd = "mogenerator --template-var arc=true "\
"--model My_Project/Model.xcdatamodeld/Model.xcdatamodel/ "\
"--output-dir My_Project/Model/"
import lldb
def GetFirstArgumentAsValue(target, frame):
# Note: I assume the PC is at the first instruction of the function, before the stack and registers have been modified.
if target.triple.startswith('i386'):
espValue = frame.regs[0].GetChildMemberWithName("esp")
address = espValue.GetValueAsUnsigned() + target.addr_size
return espValue.CreateValueFromAddress('arg0', address, target.FindFirstType('id'))
else:
return frame.regs[0].GetChildMemberWithName("arg1")
@jkubicek
jkubicek / mdown-wiki
Created April 11, 2013 18:02
Use pandoc to convert github styled markdown files to Wikipedia style wiki pages.
#!/bin/bash
#usage
# mdown-wiki input_file.mdown
#
# Generates a file in the same directory named 'input_file.wiki'
FILENAME="${1%%.*}"
pandoc --from=markdown_github --to=mediawiki --output=$FILENAME.wiki "$1"
@jkubicek
jkubicek / ascii_art
Last active December 15, 2015 19:10
Emoticon Faces
/code _-====-__-======-__-========-_____-============-__
_( coffee _)
OO( train )_
0 (_ choo! _)
o0 (_ choo! _)
o '=-___-===-_____-========-___________-===-dwb-='
.o _________
. ______ ______________ | | _____
_()_||__|| ________ | | |_________| __||___||__
(BNSF 1995| | | | | __Y______00_| |_ _|
@jkubicek
jkubicek / .git-completion.sh
Created March 13, 2013 20:30
Git tab completion script
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@jkubicek
jkubicek / .bash_profile
Last active May 24, 2016 23:02
my .bash_profile
#!/bin/bash
# Functions to change tab and window names in Terminal
function tabname {
if [ -z $1 ]
then
printf "\e]1;${PWD##*/}\a"
else
printf "\e]1;$1\a"
@jkubicek
jkubicek / git-open-file-github
Created March 7, 2013 00:52
Opens the currently active Xcode file in GitHub
#!/usr/bin/env ruby
# Get the current Xcode file
filename = `osascript -e 'tell application "Xcode" to set current_document_path to path of last source document'`
# Parse the file name
name = File.basename(filename)
dir = File.dirname filename
# Change to the working directory of our repo
@jkubicek
jkubicek / git-merge-it
Created March 1, 2013 19:06
Merges the current branch into master and deletes the branch. Doesn't attempt to fix any issues and will fail if something goes wrong.
#! /usr/bin/ruby
unless `git status -s`.strip.empty?
puts "Cannot merge-it when your working directory is dirty.\nClean that shit up, bruh"
exit
end
curr_branch = `git branch | grep "*" | sed "s/* //"`.strip
system("git checkout master && git merge #{curr_branch} && git branch -d #{curr_branch}")