Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Gonyea sgonyea

View GitHub Profile
View pasteRTFasMarkdown.sh
#!/bin/sh
# Convert RTF contents of clipboard to HTML
osascript -e 'the clipboard as «class RTF »' | \
perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | \
textutil -format rtf -convert html -stdin -stdout | \
pandoc -f html -t markdown | \
pbcopy
View pasteRTFasHTML.sh
#!/bin/sh
# Convert RTF contents of clipboard to HTML
osascript -e 'the clipboard as «class RTF »' | \
perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | \
textutil -format rtf -convert html -stdin -stdout | \
ruby -ne '@found=true if $_ =~ /<body>/; next unless @found; exit if $_ =~ /<\/body>/; puts $_;' | \
grep -v "</body>" | \
pbcopy
View clipboardRTF2HTML.sh
#!/bin/sh
# This script converts RTF text on the OS X clipboard to HTML.
osascript -e 'the clipboard as «class RTF »' | \
perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | \
textutil -format rtf -convert html -stdin -stdout | \
ruby -ne '@found=true if $_ =~ /<body>/; next unless @found; puts $_; exit if $_ =~ /<\/body>/' | \
grep -v "<body>" | \
View Has weird right-to-left characters.txt
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@sgonyea
sgonyea / functions.sh
Created Jun 26, 2014
transparent local development with Vagrant / mapped back to Varnish
View functions.sh
function start-vagrant-ssh-port-forward {
ssh-add ~/.vagrant.d/insecure_private_key 2>&1 >/dev/null
# The `# ...` are a way to slip comments into the command
ssh -L 11211:127.0.0.1:11211 `# <- memcached` \
-L 3306:127.0.0.1:3306 `# <- mysql` \
-L 6379:127.0.0.1:6379 `# <- redis 1` \
-L 6380:127.0.0.1:6380 `# <- redis 2` \
-L 26379:127.0.0.1:26379 `# <- redis sentinel` \
-L 9312:127.0.0.1:9312 `# <- dev sphinx` \
-L 9313:127.0.0.1:9313 `# <- test sphinx` \
View .bash_profile
function forward-vagrant-ports {
ssh-add ~/.vagrant.d/insecure_private_key
ssh -fNL 11211:127.0.0.1:11211 \
-L 3306:127.0.0.1:3306 \
-L 6379:127.0.0.1:6379 \
-L 6380:127.0.0.1:6380 \
-L 26379:127.0.0.1:26379 \
-R 8081:127.0.0.1:8081 \
vagrant@192.168.33.10
}
View router.js
/*global Ember*/
/*global Todos*/
// For more information see: http://emberjs.com/guides/routing/
Todos.Router.map(function () {
this.resource('todos', { path: '/' }, function () {
this.route('active');
this.route('completed');
});
View jquery-csv.js
/**
* jQuery-csv (jQuery Plugin)
* version: 0.71 (2012-11-19)
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
*
* Acknowledgements:
* The original design and influence to implement this library as a jquery
* plugin is influenced by jquery-json (http://code.google.com/p/jquery-json/).
View invalid.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Colorado</name>
<description><![CDATA[]]></description>
<Style id="style1">
<LineStyle>
<color>40000000</color>
<width>3</width>
</LineStyle>
You can’t perform that action at this time.