Skip to content

Instantly share code, notes, and snippets.

View troutcolor's full-sized avatar

John Johnston troutcolor

View GitHub Profile
View sendToWordPress.js
if(op.attributes.exists("type") && op.attributes.getOne("type")=="outline"){
var wp_post = opml.parse(op.getCursorOpml());
var title = wp_post.opml.head.title;
var text = "";
var imagepart="";
for (i=0;i<wp_post.opml.body.subs[0].subs.length;i++){
if(wp_post.opml.body.subs[0].subs[i].image !==undefined){
var imagepart="<p><img src='"+wp_post.opml.body.subs[0].subs[i].image+"'></p>";
Paraphraser / Mount Raspberry Pi home directory on your
Last active February 21, 2024 05:18
Using SSHFS to mount your Raspberry Pi's home directory on your Mac
View Mount Raspberry Pi home directory on your

Using SSHFS to mount your Raspberry Pi's home directory on your Mac

It is useful to be able to mount your Raspberry Pi's file system on your Mac's desktop. The Raspberry Pi is ready to rock-'n-roll but some work needs to be done on the Mac. This gist assumes macOS Mojave 10.14. Your mileage may vary on earlier or later versions.

Set up passwordless SSH (optional)

You can make your life quite a bit simpler if you set up SSH on your Mac so that it can login to your Raspberry Pi without needing a password. Follow this tutorial.

The tutorial assumes two Raspberry Pis but there is no difference in approach if you use a Mac and a Pi, or two Macs.

rcarmo / bt-agent.service
Last active December 12, 2023 13:14
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
View bt-agent.service
# in /etc/systemd/system
Description=Bluetooth Agent
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
sardisson / Thumbnail image from post.applescript
Last active August 18, 2019 07:41
AppleScript to create a thumbnail from the first image present in a post
View Thumbnail image from post.applescript
* Thumbnail image from post
* Creates a thumbnail from the first image present in a given post
* v1.0.7
* 2019-08-18
on run
-- gruber's get browser routine, with a twist to exclude non-Apple/Google browsers
danielmcclure / remove-cpt-feed-titles.php
Created July 21, 2017 03:56
Remove Title from Custom Post Type Feeds
View remove-cpt-feed-titles.php
// Remove Title from 'Status' Custom Post Type Feed
function remove_post_title_rss($title) {
global $post;
$post_type = get_post_type($post->ID);
if ($post_type == 'status') {
$title = '';
return $title;
scripting / mylist.opml
Last active July 8, 2017 07:29
An example of an OPML subscription list that includes another list.
View mylist.opml
<?xml version="1.0"?>
<opml version="2.0">
<outline text="Feeds" type="include" url=""/>
able8 / Export Notes.AppleScript
Created May 16, 2017 08:34
Export Apple Notes via AppleScript
View Export Notes.AppleScript
tell application "TextEdit"
make new document
end tell
tell application "Notes"
if folder "Archive" exists then
set output to ""
repeat with aNote in notes in folder "Archive"
stephenharris / import-venues.php
Created March 21, 2017 11:12
A WP-CLI command to import a CSV of venues
View import-venues.php
Plugin Name: Import Venues WP CLI command
Plugin URI:
Description: Adds `wp eo venue import <path-to-file>` command.
Author: Stephen Harris
Version: 0.1
// Exit if accessed directly
darrenpmeyer / unix_dates.scpt
Created August 31, 2015 21:04
Convert AppleScript date objects to UNIX timestamp or POSIX date format
View unix_dates.scpt
-- convert an AppleScript Date object to a POSIX date CCYYMMDDHHmm.SS
on posixDate(datetime)
-- date -j -f "%A, %B %e, %Y at %I:%M:%S %p" "Tuesday, September 1, 2015 at 11:00:00 AM" +%Y%m%d%H%M
set command to "date -j -f '%A, %B %e, %Y at %I:%M:%S %p' '" & datetime & "'"
set command to command & " +%Y%m%d%H%M.%S"
set thePosixDate to do shell script command
return thePosixDate
end posixDate
RichardHyde / gist:3386ac57b55455b71140
Last active June 21, 2020 09:09
Convert a date string to a date in Applescript
View gist:3386ac57b55455b71140
-- Convert date function. Call with string in YYYY-MM-DD HH:MM:SS format (time part optional)
to convertDate(textDate)
set resultDate to the current date
set the month of resultDate to (1 as integer)
set the day of resultDate to (1 as integer)
set the year of resultDate to (text 1 thru 4 of textDate)
set the month of resultDate to (text 6 thru 7 of textDate)
set the day of resultDate to (text 9 thru 10 of textDate)
set the time of resultDate to 0