Skip to content

Instantly share code, notes, and snippets.

View extratone's full-sized avatar
🗿
sudo exit

David Blue extratone

🗿
sudo exit
View GitHub Profile
--------------------------------------------------
--------------------------------------------------
-- Import tasks from Things to OmniFocus
--------------------------------------------------
--------------------------------------------------
--
-- Script taken from: http://forums.omnigroup.com/showthread.php?t=14846&page=2
-- Added: creation date, due date, start date functionality
-- Empty your Things Trash first.
-- Note that this won't move over scheduled recurring tasks.
@extratone
extratone / example.html
Created September 21, 2022 18:16 — forked from stephanbogner/example.html
Extract hex color codes from a string (e.g. text, SVG, HTML, XML) using a regex in JS
<script type="text/javascript">
let testString = ''
testString += '<div style="color: #00A9F8"></div><div style="color: #12345"></div>';
testString += '<div style="color: 00A9F8"></div><div style="color: #123456"></div>';
testString += '<div style="color: #fff"></div><div style="color: #000"></div>';
let regularExpression = /#(?:[0-9a-fA-F]{3}){1,2}/g // btw: this is the same as writing RegExp(/#(?:[0-9a-fA-F]{3}){1,2}/, 'g')
let extractedHexCodes = testString.match(regularExpression);
@extratone
extratone / tm.bash
Created September 21, 2022 14:46 — forked from ttscoff/tm.bash
A shell function to wrap tmux and make the basic commands a bit easier
#!/bin/bash
__lower() {
echo "$@"|tr "[:upper:]" "[:lower:]"
}
__menu() {
local result=""
PS3=$1
shift
@extratone
extratone / init.lua
Created September 21, 2022 14:44 — forked from ttscoff/init.lua
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
@extratone
extratone / macosDND.m
Created September 21, 2022 14:44 — forked from ttscoff/macosDND.m
Objective-C code for toggling Do Not Disturb on macOS (including Big Sur)
/// Turn Do Not Disturb on or off
/// Only handles on and off, no schedules
/// @param enabled true on, false off
- (void)setDND:(BOOL)enabled {
NSLog(@"Turning Do Not Disturb %@", (enabled ? @"on" : @"off"));
if (@available(macOS 11.0, *)) {
NSUserDefaults * defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.ncprefs"];
NSData * subPlistData = [defaults objectForKey:@"dnd_prefs"];
NSMutableDictionary * propertyListDict = [[NSPropertyListSerialization propertyListWithData:subPlistData options:0 format:nil error:nil] mutableCopy];
@extratone
extratone / TextExpander to Text Shortcuts.applescript
Created September 17, 2022 02:12 — forked from Zettt/TextExpander to Text Shortcuts.applescript
TextExpander Snippet to iOS/OS X Text Shortcuts. Read more: http://tmblr.co/ZFavEy-uZJ-M
set clickDelay to 0.3
set abbreviationList to {}
set snippetsList to {}
set disallowedGroups to {"AutoCorrect", "AutoCorrect Deutsch Snippets", "AlteNeue Rechtschreibung", "Deutsche Akronyme"}
set disallowedSnippetContents to {"%e", "%d", "%a", "%A", "%m", "%1m", "%b", "%B", "%y", "%Y", "%H", "%I", "%1H", "%1I", "%M", "%1M", "%S", "%1S", "%p", "%@+", "%@-", "%key:", "%clipboard", "%|", "%<", "%^", "%>", "%v", "%-", "%+", "%fill:", "%fillpart:", "%filltext:", "%fillpopup:", "%fillarea:"}
-- open the Text tab of Keyboard preferences
tell application "System Preferences"
activate
delay 5
@extratone
extratone / convert_url_files_to_bookmarks.sh
Created September 15, 2022 17:19 — forked from GeoffreyPlitt/convert_url_files_to_bookmarks.sh
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
#!/bin/bash
#
# Run this script in a folder full of ".url" files, and pipe output to an HTML file.
# Example: ./convert_url_files_to_bookmarks.sh > bookmarks.html
echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
@extratone
extratone / remove_links.py
Created September 15, 2022 11:11 — forked from maybemkl/remove_links.py
Remove markdown wiki-link brackets during pandoc exports
// add-note.scpt
//
// Example of creating a new note in Notes.app using JavaScript for Automation
// Steven Frank <[email protected]>
notesApp = Application('Notes');
notesApp.activate();
var note = notesApp.Note({
@extratone
extratone / top-brew-packages.txt
Created September 8, 2022 05:13 — forked from pmkay/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
coreutils: GNU File, Shell, and Text utilities
pkg-config: Manage compile and link flags for libraries
chromedriver: Tool for automated testing of webapps across many browsers
awscli: Official Amazon AWS command-line interface
automake: Tool for generating GNU Standards-compliant Makefiles