Skip to content

Instantly share code, notes, and snippets.

@johan
johan / sandbox-breaker.js
Created August 23, 2010 10:39
Breaks out of the Greasemonkey / Google Chrome user script sandbox and runs the code in the page scope instead, free of sandbox gotchas and deprived of all privileged API:s.
// This block of code injects our source in the content scope and then calls the
// passed callback there. The whole script runs in both GM and page content, but
// since we have no other code that does anything, the Greasemonkey sandbox does
// nothing at all when it has spawned the page script, which gets to use jQuery.
// (jQuery unfortunately degrades much when run in Mozilla's javascript sandbox)
(function(run_me_in_page_scope) {
if ('undefined' == typeof __RUNS_IN_PAGE_SCOPE__) { // unsandbox, please!
var src = arguments.callee.caller.toString(),
script = document.createElement('script');
script.setAttribute("type", "application/javascript");
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@3demax
3demax / tabbar-tweak.el
Created October 5, 2011 14:58
Emacs tabbar-mode visual tweaks
;; This are setting for nice tabbar items
;; to have an idea of what it looks like http://imgur.com/b0SNN
;; inspired by Amit Patel screenshot http://www.emacswiki.org/pics/static/NyanModeWithCustomBackground.png
;; Tabbar
(require 'tabbar)
;; Tabbar settings
(set-face-attribute
'tabbar-default nil
:background "gray20"
@timkuijsten
timkuijsten / sshsock
Last active April 10, 2018 20:43
Quick 'n dirty VPN for macOS
#!/bin/sh
# sshsock - Quick 'n dirty VPN for macOS
#
# Usage example:
# Let Apple Mail, Safari and Firefox route all traffic via your ssh server at
# foo.example.com by using a system-wide local SOCKS proxy:
#
# $ sshsock foo.example.com
# Password:
@railwaycat
railwaycat / mac-switch-meta.el
Created August 28, 2012 13:43
meta key switch
;; Keybonds
(global-set-key [(hyper a)] 'mark-whole-buffer)
(global-set-key [(hyper v)] 'yank)
(global-set-key [(hyper c)] 'kill-ring-save)
(global-set-key [(hyper s)] 'save-buffer)
(global-set-key [(hyper l)] 'goto-line)
(global-set-key [(hyper w)]
(lambda () (interactive) (delete-window)))
(global-set-key [(hyper z)] 'undo)
@dabrahams
dabrahams / launchd.org
Last active April 28, 2024 16:36
Notes on Apple's under-documented launchd

Notes on Apple’s Under-Documented LaunchD

Start triggers fire regardless of other conditions

For example, StartOnMount=true will cause the job to start when anything is mounted even if other conditions, e.g. QueueDirectories, say the job should not run

Rhythm of repeating jobs

The StartInterval timer begins ticking at the moment the plist is loaded. If something like QueueDirectories is preventing the job from

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@hiltmon
hiltmon / merge_asana_into_omnifocus.rb
Created November 3, 2013 22:49
Merge Asana Projects, Tasks and SubTasks into OmniFocus
#!/usr/bin/env ruby
# merge_asana_into_omnifocus.rb
# Hilton Lipschitz
# http://www.hiltmon.com
# Use and modify freely, attribution appreciated
# Script to import Asana projects and their tasks into
# OmniFocus and keep them up to date from Asana.
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results