Skip to content

Instantly share code, notes, and snippets.

View surrealroad's full-sized avatar

Jack James surrealroad

View GitHub Profile
@surrealroad
surrealroad / gist:5146661
Last active April 6, 2016 03:26
Digital Ocean Discourse production install with LAMP (using Apache)
#create & deploy lamp droplet
#login via ssh as root
#initial setup (ref: http://library.linode.com/getting-started#sph_logging-in-for-the-first-time)
# update /etc/hosts (to "thalassophobia.surrealroad.com")
nano /etc/hosts
#
@surrealroad
surrealroad / Fetch Discourse Topics
Last active March 6, 2016 17:12
jQuery snippet to grab latest discourse forum posts and display them inside a container uses TBS classes
// usage
var forumURL = 'http://forums.com';
$('#discourse-latest-container').getDiscourseTopics(forumURL, 'latest');
// fetch discourse items
(function($) {
jQuery.fn.getDiscourseTopics = function (url, page) {
// load forum topics
if($(this).exists()) {
$this = $(this);
@surrealroad
surrealroad / Parallels 9 Lamp
Last active December 30, 2015 11:29
How to create a LAMP using Parallels Desktop 9
1. File > New…
2. Download Ubuntu Free
3. Set parallels user password
4. Install Parallels Tools / Restart
5. `sudo apt-get update`
6. `sudo apt-get install apache2`
7. `sudo apt-get install mysql-server`
8. `sudo apt-get install php5 libapache2-mod-php5`
9. Test browsing to http://localhost or http://parallels-ip-address
10. `sudo apt-get install openssh-server`
@surrealroad
surrealroad / FDX_Queries
Created June 23, 2014 15:23
XPath Queries for Final Draft 8+ XML files (.fdx)
// get paragraphs
"/FinalDraft/Content/Paragraph"
// paragraph text
"/FinalDraft/Content/Paragraph[" & $paragraphIndex & "]/Text"
// scene summary
"/FinalDraft/Content/Paragraph[" & $paragraphIndex & "]/SceneProperties/Summary/Paragraph/Text"
// paragraph type
@surrealroad
surrealroad / FCP7XML_queries
Created June 23, 2014 15:32
XPath Queries for Final Cut Pro 7 XML files
// clips
"//clip"
// shot-take
"//clip[" & $clipIndex & "]/logginginfo/shottake"
// scene
"//clip[" & $clipIndex & "]/logginginfo/scene"
// default angle
@surrealroad
surrealroad / Duplicate files & folders without content
Last active August 29, 2015 14:06
Duplicate files & folders without content
# http://stackoverflow.com/a/25847006/262455
# If there are only directories and regular files, you can do something like this:
cd "$src"
find . -type d -print0 | ( cd "$dst" ; xargs -0 mkdir -p )
find . -type f -print0 | ( cd "$dst" ; xargs -0 touch )
@surrealroad
surrealroad / Plex_package_fix.sh
Last active August 29, 2015 14:15
Reformat Plex package for atom synology
# https://forums.plex.tv/index.php/topic/127360-this-package-does-not-contain-a-digital-signature/#entry763580
mkdir PlexMediaServer-0.9.11.7.803-87d0708-x86
cd PlexMediaServer-0.9.11.7.803-87d0708-x86
tar xvzf ../PlexMediaServer-0.9.11.7.803-87d0708-x86.spk
perl -pi -e 's/evansport/evansport avoton/g' INFO
tar -zcvf ../PlexMediaServer-0.9.11.7.803-87d0708-x86_atom.spk *
@surrealroad
surrealroad / Convert Avid Batch file newlines.sh
Last active August 29, 2015 14:20
Convert Avid batch newlines to Mac/Unix-friendly ones
# using sed
sed $'s/\\\r/\\\n/g' $FILE
# using tr
tr "\r" "\n" < "$FILE"
@surrealroad
surrealroad / find_fields_in_pages.rb
Last active November 23, 2015 16:39
Shotgun: find all pages a field is used on (Courtesy pboucher)
=begin
Find pages a field is used on
1. Edit the last line in the following script to reference the
appropriate field & entity
2. Paste the whole thing into the Ruby console for the site in
question
=end
@surrealroad
surrealroad / showquery.php
Created August 10, 2015 13:59
dump wordpress query
<?php
echo "<pre>"; print_r($wp_query->query_vars); echo "</pre>";
?>