Skip to content

Instantly share code, notes, and snippets.

@dgraham
dgraham / make-icns
Created February 8, 2015 00:26
png -> icns
if [ $# -ne 1 ]; then
echo "Usage: make-icns icon.png"
exit 1
fi
IMAGE=$1
OUT=`basename ${IMAGE%\.*}`.iconset
mkdir $OUT
sizes=(16 32 128 256 512)
@ottoradke
ottoradke / Google Chrome Incognito
Created December 9, 2014 06:58
Google Chrome Incognito Window
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set chrome_running to is_running("Google Chrome")
if chrome_running then
tell application "Google Chrome"
repeat with w in (windows)
if mode of w is "incognito" then
set index of w to 1
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}
@pwittchen
pwittchen / convert_windows_line_endings_to_unix.sh
Created November 6, 2014 08:10
How to convert Windows line endings to Unix
# http://stackoverflow.com/a/19283453
# run the following command in the terminal
sed -i 's/\r//g' file
@chendrix
chendrix / prelude.hs
Created September 18, 2014 06:00
"Policy" implementation in haskell
module Policy where
import Data.List
type Reason = String
type Reasons = [Reason]
data Policy = Invalid Reasons | Valid
instance Show Policy where
show Valid = "Valid"
show (Invalid reasons) = "Invalid: " ++ (intercalate ". " reasons) -- intercalate == Ruby's join
@unRob
unRob / iconiza.rb
Last active February 2, 2016 01:38
Convierte una imagen en un archivo .icns
#!/usr/bin/env ruby
# encoding: utf-8
src = ARGV[0]
if src == ''
puts "Usage: ./iconiza take five.jpg"
puts "Convierte una imagen en un archivo .icns"
end
@almostintuitive
almostintuitive / SVGView.h
Created June 8, 2014 15:51
SVGView for iOS (using UIWebView)
//
// SVGView.h
// Just call the loadSVG method with the SVG's NSData to display it with transparent background & scrollbars.
//
// github.com/itchingpixels.
//
#import <UIKit/UIKit.h>
@interface SVGView : UIWebView <UIWebViewDelegate>
@shirshir
shirshir / gist:8400570
Created January 13, 2014 13:47
Recursive .zip excluding .git and .DS_Store
zip -r files.zip ./directory -x "*.git*" -x "*.DS_Store"
@zdne
zdne / Google Chrome Incognito.applescript
Last active January 31, 2023 19:38
Google Chrome Incognito – AppleScript to always run chrome in incognito mode. Save as an application to your Application folder. Optionally drag a and drop Google Chrome Icon in between Get Info panes (⌘+I)
if application "Google Chrome" is running then
tell application "Google Chrome" to make new window with properties {mode:"incognito"}
else
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito"
end if
tell application "Google Chrome" to activate
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten