Skip to content

Instantly share code, notes, and snippets.

@g-r-a-v-e-l-y
g-r-a-v-e-l-y / add-file-to-torrent-or-nzb-queue.applescript
Last active May 30, 2022 14:39
I use Transmission and sabnzbd behind a basic auth http proxy kinda like this now
on adding folder items to thisFolder after receiving added_items
repeat with addedFile in added_items
tell application "Finder"
if (the name of the addedFile ends with "torrent") then
set transmissionRemote to "/usr/local/bin/transmission-remote https://TRANSMISSION_HOST/transmission -n 'USERNAME:PASSWORD' --add '" & POSIX path of addedFile & "' | sed 's/\"//g' | grep -oE '[^ ]+$'"
set fileName to name of (info for addedFile)
display notification fileName with title "Torrent Janitor - Queueing Torrent"
set transmissionResponse to do shell script transmissionRemote
display notification fileName with title "Torrent Janitor - " & transmissionResponse
tell application "Finder"
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / URL!.js
Created December 24, 2015 15:51
A Safari bookmarklet to alert the URL with no anchors or parameters. Make your first favorite to use with Option-Command-1.
javascript:(function(){%20%20%20%20alert(document.location.protocol%20+"//"+%20document.location.hostname%20+%20document.location.pathname)})();
### Keybase proof
I hereby claim:
* I am grantstavely on github.
* I am grantstavely (https://keybase.io/grantstavely) on keybase.
* I have a public key whose fingerprint is B6B2 B7DB 961B 290C 5F33 1725 A067 55D6 88AF 5060
To claim this, I am signing this object:
#!/bin/sh
# toggle http://code.google.com/p/macosx-nosleep-extension/ off
/usr/local/bin/NoSleepCtrl -s 0,0
#!/bin/sh
# toggle http://code.google.com/p/macosx-nosleep-extension/
/usr/local/bin/NoSleepCtrl -s 1,1
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / org.archiveteam.warrior.plist
Created August 21, 2013 14:09
Run ArchiveTeam's Warrior automatically, headlessly. launchctl load -w ~/Library ~/Library/LaunchAgents/org.archiveteam.warrior.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.archiveteam.warrior</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/VBoxHeadless</string>
<string>-s</string>
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / default.vcl
Created July 14, 2013 03:46
An example varnishd config virtual hosting backend services on localhost that are on non-standard ports, because memorizing ports for things is dumb (and so is /etc/services).
backend splunk{
.host = "127.0.0.1";
.port = "8000";
}
backend archiveteam{
.host = "127.0.0.1";
.port = "8001";
}
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / gist:5918037
Created July 3, 2013 13:55
iTerm2 -> mosh -> remote xterm-256color with mouse support in tmux, vim, weechat, etc. Hold option to release.
# https://github.com/keithw/mosh/issues/101
# thanks FiXato!
perl -E ' print "\e[?1005h\e[?1002h" '
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / gist:5657778
Created May 27, 2013 15:57
A very silly "turn chrome into a full screen kiosk and tab-rotate it with applescript" waste of time.
## settings
set lag to 120
set sites to {"http://nyan.cat", "http://grantstavely.com/files/borat.html"}
## functions
on tab_toggle(lag, sites)
set siteCount to count sites
tell application "System Events"
## lame hacks abound
@g-r-a-v-e-l-y
g-r-a-v-e-l-y / gist:5657772
Created May 27, 2013 15:56
A very silly full screen "most recent tweet" gag.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Devops Wisdom</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
function GetLastTweet(UserName) {
url = 'http://api.twitter.com/1/statuses/user_timeline/' + UserName + '.json?callback=?';
$.getJSON(url, function (tweet) {
$("#tweet").html(tweet[0].text);
});