Skip to content

Instantly share code, notes, and snippets.

View fractaledmind's full-sized avatar

Stephen Margheim fractaledmind

View GitHub Profile
@fractaledmind
fractaledmind / tree.md
Last active August 29, 2015 14:11 — forked from deanishe/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

<?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>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjIwMDAwMDAxNzkgMC4yMzkyMTU3MDE4IDAuMjc0NTA5ODE3NAAQAoAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@fractaledmind
fractaledmind / action_export-notes.scpt
Last active July 9, 2020 14:53
Cleaned up the script. Made it more readable. Removed unnecessary stuff.
(* ///
PROPERTIES
/// *)
--Formatting
(* DO NOT CHANGE *)
property line_feed : (ASCII character 10)
property md_line_feed : (ASCII character 32) & (ASCII character 32) & (ASCII character 10)
property as_delims : AppleScript's text item delimiters
import os, os.path, sys, urllib2, requests
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
# Banner-style (default)
from Foundation import NSUserNotification, NSUserNotificationCenter
def notify(title, subtitle, text):
notification = NSUserNotification.alloc().init()
notification.setTitle_(str(title))
notification.setSubtitle_(str(subtitle))
notification.setInformativeText_(str(text))
notification.setSoundName_("NSUserNotificationDefaultSoundName")
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
@fractaledmind
fractaledmind / Accept, Reject, Alter CriticMarkup Doc (VERSION 2.0)
Last active December 21, 2015 16:59 — forked from fractaledmind/Accept, Reject, Alter CriticMarkup Doc
I rewrote the entire script from the ground up. Changes: --Script moves sentence by sentence and alters text each time, so that Contextual views become less and less cluttered. --Added Contextual View to see the whole paragraph containing Markup in question. This script takes as input a text with CriticMarkup in it and allows the user to either …
(* ACCEPT/REJECT CRITICMARKUP CHANGES
--Stephen Margheim
--23 July 2013
--open source
--VERSION 2.0
I rewrote the entire script from the ground up.
Changes:
--Script moves sentence by sentence and alters text each time, so that Contextual views become less and less cluttered.