Skip to content

Instantly share code, notes, and snippets.

View jkubicek's full-sized avatar

Jim Kubicek jkubicek

View GitHub Profile
#!/bin/bash
# Create Git Repository
# created by Jim Kubicek, 2009
# jimkubicek@gmail.com
# http://jimkubicek.com
# DESCRIPTION
# Create remote git repository from existing project
# this script needs to be run from within the project directory
@jkubicek
jkubicek / git-checkout-main
Last active February 8, 2021 21:02
Git Tools
git checkout (git-main)
git pull
@jkubicek
jkubicek / script_runner.md
Last active July 28, 2017 04:25
Script running Fish script

The s function takes a single string argument and runs an executable located in the ./scripts/ directory that has the same path as the parameter

function s --argument SCRIPT_NAME
  eval ./scripts/$SCRIPT_NAME
end

The print-scripts function returns a space-separated list of all executables located in ./scripts/

@jkubicek
jkubicek / AlertQueue.swift
Last active June 30, 2017 18:29
Dispatch Alert Queue for iOS
//: Playground - noun: a place where people can play
import Foundation
import PlaygroundSupport
class AlertQueue {
private let queue = DispatchQueue(label: "com.collectivehealth.alertqueue")
typealias Completion = () -> ()
@jkubicek
jkubicek / formatting.swift
Created June 15, 2016 19:01
Swift Formatting
import UIKit
//: # Collections
// This is bad
let badArray = ["one", "two", "apple",
"orange", "elephant", "orangutan"]
// This is good
let goodArray = ["one",
"two",
import Foundation
struct ExpensiveType {
init(name: String) {
print("This is expensive: \(name)")
}
}
class MyType {
@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 / open-in-gmail.scpt
Created February 25, 2016 17:57
Applescript to open the currently selected Mail message in Gmail
tell application "Mail"
set the_messages to selected messages of first message viewer
set the_headers to all headers of item 1 of the_messages
set thecommandstring to "echo \"" & the_headers & "\"| sed -n -e 's/Message-Id: <\\(.*\\)>/\\1/p'" as string
set sedResult to do shell script thecommandstring
set link to "https://mail.google.com/mail/#search/in%3Aanywhere+rfc822msgid%3A" & sedResult
do shell script "open " & link
end tell
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"