Skip to content

Instantly share code, notes, and snippets.

View martinpi's full-sized avatar

Martin Pichlmair martinpi

View GitHub Profile
@martinpi
martinpi / SyntaxHighlighter.swift
Created October 13, 2018 14:27
A simple Swift 4.0 class for syntax highlighting in an NSTextView
//
// SyntaxHighlighter.swift
// CardsCardsCards
//
// Created by Martin Pichlmair on 12/10/2018.
//
// Based on https://raw.githubusercontent.com/kuyawa/Macaw/master/Macaw/Macaw.swift
import Cocoa
@martinpi
martinpi / sync-git.sh
Created September 17, 2018 10:00
Update all my copies of Unitilities to the most recent commit
#!/bin/bash
find /Users/pi/Projects -name "Unitilities" -exec sh -c '
for file do
echo "\033[0;32m[ Updating $file ]\033[0m"
cd "$file"
git pull
done
' sh {} +
@martinpi
martinpi / init.sh
Created September 10, 2018 11:24
A little script I use to init git repositories (including those hosted on GitHub and BitBucket). You have to register a push-enabled public key first and it expects a .gitignore and some utility libraries in the same folder.
# usage
# init.sh <repository> <folder>
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
if [ -d $2/Assets ]; then
echo "Setting up git repository $1"
else
echo "An init script for git hosted Unity projects"
echo "Usage: init.sh <repository> <folder>"
@martinpi
martinpi / gist:c84d5530dafb73b5a9815768f5f9a160
Created August 25, 2017 09:48
Import a folder of text files into Evernote (OSX/AppleScript)
tell application "Finder"
set fl to files of folder POSIX file "/Users/pi/Desktop/VoodoopadExport" as alias list
end tell
repeat with f in fl
set theText to (do shell script "cat " & quoted form of (POSIX path of f))
set theName to (do shell script "basename " & quoted form of (POSIX path of f))
tell application "Evernote"
create note with text theText title theName notebook "private" tags "VoodooPad"
end tell
end repeat