Skip to content

Instantly share code, notes, and snippets.

@digital-carver
digital-carver / CPANSyntaxHighlight.user.js
Last active March 5, 2019 08:03
A Greasemonkey script to enable syntax highlighting when viewing module sources on CPAN
// ==UserScript==
// @name CPANSyntaxHighlight
// @namespace abiteasier.in
// @description Enable syntax highlighting when viewing the source on CPAN
// @include http://cpansearch.perl.org/src/*
// @version 0.9
// @require http://yandex.st/highlightjs/7.3/highlight.min.js
// @resource syntaxHighlightCSS http://yandex.st/highlightjs/7.3/styles/github.min.css
// @grant GM_addStyle
// @grant GM_getResourceText
@DGrady
DGrady / README.org
Last active March 11, 2019 19:10
Pretty printing delimited text files at the command line

Pretty printing delimited text files at the command line

Sometimes, you’d like to look at delimited files on the command line:

cat test.csv

@imliam
imliam / cmd.lua
Created April 26, 2017 16:01
Command line argument parsing
command_strings = {
'php artisan make="hi mate" heh "I have a value"',
"php artisan make:auth",
[[I "am" 'the text' and "some more text with '" and "escaped \" text"]],
[[1 2 word 2 9 'more words' 1 "and more" "1 2 34"]],
[[omo "This is a string!" size=14 font="Comic Sans" break= hmm "thing and 'thing'" ]]
}
function command_parse(s)
local t={}
@rithvikgv
rithvikgv / gist:1916925
Created February 26, 2012 13:53
AppleScript to snap windows to the right à la Windows 7 Aero Snap
-- get Dock height
tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
set desktop_dimensions to bounds of window of desktop
set new_width to (item 3 of desktop_dimensions) / 2
set new_height to (item 4 of desktop_dimensions) - dock_height
@codeshrew
codeshrew / open-chrome-disable-web-security.scpt
Last active March 31, 2019 22:27
Launches Google Chrome with web security disabled. This disables the same origin policy for API calls and can ease development from a dev environment not in a server's CORS settings
(* Launches Google Chrome with web security disabled.
This disables the same origin policy for API calls and can
ease development from a dev environment not in a server's CORS settings *)
(* This same command can be sent to Canary by changing
'Google Chrome.app' to 'Google Chrome Canary.app' *)
do shell script "open -a 'Google Chrome.app' --args --disable-web-security --allow-running-insecure-content"
(* If you want to not use your current user in Chrome you can set --user-data-dir to point to /tmp
@n8henrie
n8henrie / duplicateFinderTab.applescript
Created August 2, 2014 16:44
Uses a hacky workaroud to duplicate the frontmost Finder tab, since Apple hasn't provided great AppleScript support for this.
-- duplicateFinderTab.scpt
-- Uses a hacky workaroud to duplicate the frontmost Finder tab,
-- since Apple hasn't provided great AppleScript support for this.
-- Details at:
on new_tab()
tell application "System Events" to tell application process "Finder"
set frontmost to true
tell front menu bar to tell menu "File" to tell menu item "New Tab"
perform action "AXPress"
@SamRothCA
SamRothCA / gitfinderstats.sh
Last active April 1, 2019 17:59
Git status for repo currently open in Finder
cd "$(osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)')" &&
git status --short --branch
@tkambler
tkambler / gist:5222d276f783def5ece8
Last active April 1, 2019 18:02
Displaying Tabular Data in Today Scripts for Yosemite Notification Center
#!/usr/local/bin/node
var Table = require('cli-table');
var table = new Table({
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
style: { 'padding-left': 0, 'padding-right': 0 }
@JorelAli
JorelAli / Video Salvager.js
Last active April 11, 2019 01:26
A bookmarklet to help retrieve information on deleted videos in a YouTube playlist
javascript: /* Video salvager bookmarklet */
/*
Usage: Run this bookmarklet when viewing a list of a playlist.
The link should be something like https://www.youtube.com/playlist?list=[BUNCH_OF_LETTERS_AND_NUMBERS]
Why use this: There have been too many times that I've lost the title of an important
YouTube video from a playlist of mine and have no idea what the video title was called.
Unfortunately, this no longer works for certain playlists (for example, Watch Later) as
YouTube will automatically remove them from the playlist if a video within it was deleted.
function find_roku {
for i in $(arp -a | awk '{print $2}' | sed "s/[(|)]//g"); do
curl $i:8060 &>/dev/null
if [[ "$?" == "0" ]]; then
echo $i
export ROKU_IP=$i
fi
done
}