Skip to content

Instantly share code, notes, and snippets.

@nikcub
nikcub / mails.sh
Created Sep 12, 2011
send email with mail.app via terminal
View mails.sh
#!/bin/sh
/usr/bin/osascript > /dev/null <<ASCPT
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')"
set recipientName to "John Doe"
set recipientAddress to "nobody@nowhere.com"
set theSubject to "Email from standard input"
set theContent to "This email was created and sent using AppleScript!"
tell application "Mail"
@nikcub
nikcub / mails.sh
Created Sep 12, 2011
Send email with Mail.app from command line script
View mails.sh
#!/bin/sh
/usr/bin/osascript > /dev/null <<ASCPT
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')"
set recName to "Nik Cubrilovic"
set recAddr to "nikcub@gmail.com"
set theSubject to "Email from standard input"
tell application "Mail"
View chrome.refresh.sh
#!/bin/bash
# Chrome Refresh
#
# nik cubrilovic - nikcub.appspot.com
#
# Simple applescript browser reloader for Google Chrome. It will either open a
# new tab with the url passed in as an argument or refresh an existing tab.
#
# Link this up with watchr to auto-refresh browser windows when you save files
@nikcub
nikcub / admin.less
Created Nov 11, 2011
example bootstrap file
View admin.less
// to build:
// lessc <filename> > site.css
// lessc <filename> > site.min.css --compress
// the swatch
@color1: #55626b;
@color2: #6c9380;
@color3: #c1ca55;
@color4: #f07d6b;
@color5: #ad5472;
View gist:2634960

Comicsansify;")

@nikcub
nikcub / Spotify.scpt
Created Aug 20, 2012
Mute Spotify Ads
View Spotify.scpt
--Mute Spotify when ads are playing. Use if in a country where you can't
--purchase a pro account. Open AppleScript editor (Applications > Utilities)
--paste this script in and then go File -> Save As, change 'File Format' to
--'Application' and save somewhere. Run Spotify using that application.
set currentTrack to ""
do shell script "open -a \"Spotify\""
delay 5
@nikcub
nikcub / google-serp.user.js
Created Sep 14, 2012
rewrite google search result page to link directly to search result url
View google-serp.user.js
// Google SERP URL rewrite
//
// User script will rewrite search engine results page for Google and place real
// links to results rather than links that proxy back via google.
//
// So you go straight to the page when you click and you can copy/paste the link
//
// Install:
// 1. Download to desktop/wherever
// 2. Open Chrome extensions page (Window -> Extensions) or URL chrome://extensions
@nikcub
nikcub / nav.js
Created Sep 19, 2012
keyboard nav for xkcd 1110
View nav.js
// get the map element
var el = $('.map')[0];
// amount in pixels we want to move each keypress/hold
var move = 200;
function fakeMouseEvent(type, x, y) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent(type, true, true, window,
0, 0, 0, x, y, false, false, false, false, 0, null);
@nikcub
nikcub / clear-ga.sh
Created Oct 2, 2012
One-line shell script to clear all Google Analytics cookies from Chrome on OS X
View clear-ga.sh
#!/bin/bash
#
# shell script will clear all google analytics cookies from chrome cookie store
#
SQ3=`which sqlite3`
$SQ3 ~/Library/Application\ Support/Google/Chrome/Default/Cookies "delete from cookies where name like '__u%'"
@nikcub
nikcub / README.md
Created Oct 4, 2012
Facebook PHP Source Code from August 2007
View README.md