Skip to content

Instantly share code, notes, and snippets.

View julesjans's full-sized avatar

Jules Jans julesjans

View GitHub Profile
@julesjans
julesjans / regex.swift
Created August 17, 2017 10:39
Simplified regex handler in swift
import Foundation
extension String {
func regex(_ pattern: String) -> Bool {
return self.range(of: pattern, options: .regularExpression) != nil
}
}
let pattern = "http[s]?://[w]*.?booking.com.*aid=[0-9]+"
@julesjans
julesjans / remove-from-git.sh
Created August 18, 2017 10:40
Remove a file from GIT history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_TO_DELETE' --prune-empty --tag-name-filter cat -- --all
@julesjans
julesjans / compress.sh
Last active August 18, 2017 10:50
Compress a file/directory using hdiutil and tar
#!/bin/bash
hdiutil create -fs HFS+ -srcfolder "$1" -volname "$(basename $1)" "$1.dmg"
tar -cjf "$1.tar.bz2" -C "$(dirname $1)" "$(basename $1)"
@julesjans
julesjans / color.sh
Created September 5, 2017 06:17
Shell script to change the tag/colour of item in Finder with AppleScript
#!/bin/bash
osascript -e "tell application \"Finder\" to set label index of alias POSIX file \"$1\" to 2"