Skip to content

Instantly share code, notes, and snippets.

Avatar

Dean Jackson deanishe

View GitHub Profile
@deanishe
deanishe / alfred_alacritty_plugin.applescript
Created Sep 5, 2020
Alfred plugin to run terminal commands in Alacritty
View alfred_alacritty_plugin.applescript
on alacritty_win()
set _running to (application "Alacritty" is running)
tell application "Alacritty" to activate
tell application "System Events"
repeat while (name of first application process whose frontmost is true) is not "alacritty"
delay 0.05
end repeat
set _alacritty to first application process whose frontmost is true
-- If Alacritty was running, create a new window to run command
@deanishe
deanishe / tag.py
Created Apr 27, 2017
Tag, untag and filter by tag on macOS
View tag.py
#!/usr/bin/env python
# encoding: utf-8
# vim: ft=python
#
# tag.py
#
# Copyright (c) 2015 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
@deanishe
deanishe / text_table.py
Created Dec 26, 2016
Simple table printer for shell output
View text_table.py
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2016 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2016-12-19
#
@deanishe
deanishe / aptparse.zsh
Created Nov 1, 2016
Extract installed package names from apt-get output
View aptparse.zsh
#!/usr/bin/env zsh
pkgs=()
packages() {
while read ln; do
echo -n "$( echo $ln | cut -d " " -f2 ) "
done
}
@deanishe
deanishe / MoveMouse.js
Created Aug 21, 2016
JXA: Move mouse to centre of frontmost window
View MoveMouse.js
ObjC.import('stdlib')
ObjC.import('CoreGraphics');
// Move mouse cursor to specified position
function moveMouse(x, y) {
var pos = $.CGPointMake(x, y);
var event = $.CGEventCreateMouseEvent(null, $.kCGEventMouseMoved, pos, $.kCGMouseButtonLeft);
$.CGEventPost($.kCGHIDEventTap, event);
}
@deanishe
deanishe / rename_workflow.py
Last active Sep 25, 2018
Rename Alfred workflow folders after their Bundle IDs
View rename_workflow.py
#!/usr/bin/python
# encoding: utf-8
#
# rename_workflow
#
# Copyright (c) 2015 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-08-02
@deanishe
deanishe / packal.py
Last active Apr 28, 2019
Packal.org Python API library
View packal.py
#!/usr/bin/python
# encoding: utf-8
#
# Copyright © 2015 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-10-10
#
@deanishe
deanishe / anki.py
Last active Aug 29, 2015
Demonstration of Alfred Script Filter interaction model for entering flash cards
View anki.py
#!/usr/bin/python
# encoding: utf-8
#
# Copyright © 2015 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-04-20
#
@deanishe
deanishe / youtube-to-quicktime.sh
Created Mar 2, 2015
Open Current YouTube Video in QuickTime Player (or whatever)
View youtube-to-quicktime.sh
#!/bin/bash -e
# Instead of watching YouTube videos in your browser, stream them in
# QuickTime Player (or VLC/MPlayer etc.)
#
# youtube-dl supports hundreds of websites, so it will probably work
# for a lot of video sites.
# See https://rg3.github.io/youtube-dl/
# Get URL of current tab in browser
@deanishe
deanishe / toggle-alfred-theme.bash
Last active Aug 24, 2020
Automatically toggle Alfred dark/light themes at sunset/sunrise. You need to edit the location settings before use.
View toggle-alfred-theme.bash
#!/bin/bash -e
# Wrapper for the toggle_alfred_theme.py script at
# https://gist.github.com/deanishe/ce442c3a768adedc9c39
# (where this script also comes from)
#
# The purpose of this wrapper is to enable you to update the Python script
# without having to edit the script to change the settings each time. You keep
# them in here instead, and this script should hopefully prove dumb enough
# to require little updating...
You can’t perform that action at this time.