Skip to content

Instantly share code, notes, and snippets.

View troutcolor's full-sized avatar

John Johnston troutcolor

View GitHub Profile
@troutcolor
troutcolor / Fargo Flickr Search
Last active August 29, 2015 14:04
Using the currently selected outline text as a tag, searches flicker and adds the first 5 images found below with the html returned.
@troutcolor
troutcolor / Fargo My Flickr-menu
Last active August 29, 2015 14:04
Script menu script for Fargo. inserts last 10 flickr photos from user (replace my id for yours) into a series of headlines below current.
My Flickr-medium
var theurl = "https://api.flickr.com/services/feeds/photos_public.gne?id=71428177@N00&format=opml";
http.readUrl(theurl,
function(data) {
xmlDoc = $.parseXML(data);
var ii = 0;;
$xml = $(xmlDoc),
$xml.find("entry").each(function() {
ii++;
if (ii > 10) {
@troutcolor
troutcolor / tablinks to clip
Created June 13, 2015 16:46
Safari Tab Links to clipboard, html
@troutcolor
troutcolor / Safari Tab links to markdown list
Created June 13, 2015 16:48
create markdown list of Safari tabs
@troutcolor
troutcolor / image to width
Created July 9, 2015 19:24
resize images selected in finder (I use in Fast Scripts)
tell application "Finder"
set files_ to selection
set w to the text returned of (display dialog "What width?" default answer "500")
repeat with file_ in files_
repeat 1 times
--set imgkind to (kind of file_)
--if (imgkind does not contain "Image") then
-- exit repeat -- 1 times
@troutcolor
troutcolor / Find Flickr Photo.scpt
Last active October 22, 2015 06:52
Apple Script to find where a flickr photo (or photos) selected in the finder comes from. See http://cogdogblog.com/2015/10/21/flickr-trickr/ I use FastScripts to run this sort of thing.
tell application "Finder"
set files_ to selection
repeat with file_ in files_
set imgkind to (kind of file_)
repeat 1 times
set imgkind to (kind of file_)
if (imgkind does not contain "Image") then
@troutcolor
troutcolor / pinboardrecent.py
Last active January 10, 2016 11:36
A python script that makes a webpage, https://dl.dropboxusercontent.com/u/81715/pinboard.html, from my pinboard links with thumbnails. Most of the script borrowed from http://leancrew.com/all-this/2015/12/homemade-rss-aggregator-followup. Need webkit2png
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Most of this based on a script from http://leancrew.com/all-this/2015/12/homemade-rss-aggregator-followup/
#I added the thumbnailing with webkit2png and cut it down to one feed.
#TODO clean up old images, don't regenerate existing images, spearate css from template
import feedparser
import time
from datetime import datetime, timedelta
import pytz
@troutcolor
troutcolor / Sync gh-pages + master branches
Created April 6, 2016 14:18 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@troutcolor
troutcolor / isRetina.scpt
Created February 12, 2017 10:29
detect retina display for applescript
on isRetina()
set ret to (do shell script "system_profiler SPDisplaysDataType | awk '/Retina:/{print $2}'")
if ret is "Yes" then
return true
else
return false
end if
end isRetina
@troutcolor
troutcolor / auto-complete-gifs
Last active February 12, 2017 10:35
Makes auto complete google search gifs, needs gifsicle
--needs gifsicle http://www.lcdf.org/gifsicle/
-- updated for retina screen
set thetext to text returned of (display dialog "What do you want to autocomplete?" default answer "I hate")
set theFileName to change_case_of(thetext, "lower") & ".gif"
set tempdir to POSIX path of (path to temporary items from user domain) & "autogifs/"
try
do shell script "mkdir " & tempdir
end try