Skip to content

Instantly share code, notes, and snippets.

@esprengle
esprengle / TrueColour.md
Created January 30, 2021 20:09 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@esprengle
esprengle / .gitconfig
Created January 30, 2021 20:22 — forked from mitsuhiko/.gitconfig
Adds the ultimate of all pull request commands to git
# Alternatively don't use slog but something else. I just like that more.
[aliases]
slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
git fetch origin pull/$1/head:pr/$1 && \
git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
git branch -D PR_MERGE_HEAD && \
git checkout $b && echo && \
git diff --stat $b..pr/$1 && echo && \
@esprengle
esprengle / 01 - Comments
Created March 6, 2021 22:15 — forked from nayanseth/01 - Comments
Basics of AppleScript
(*
Script - Comments
@author - Nayan Seth
© Tech Barrack Solutions Pvt Ltd
*)
--This is a single line comment
#This is a comment too but still single line
(*
@esprengle
esprengle / callback.md
Last active April 10, 2021 20:07 — forked from maddievision/callback.md
callback - A simple small module for Pythonista (http://omz-software.com/pythonista) which aims to make an easy callback URL handling & argument passing system.

callback

A simple small module for Pythonista (http://omz-software.com/pythonista) which aims to make an easy callback URL handling & argument passing system.

Usage

  1. import callback
  2. Create a handler instance handler = callback.InfoHandler(sys.argv)
  3. Decorate command handlers with @handler.cmd(cmdname)
  4. Call handler.handle() (and if it returns False, there was nothing to handle!)
@esprengle
esprengle / Drafts.py
Created April 10, 2021 20:19 — forked from maddievision/Drafts.py
Very simple wrapper for Drafts URL scheme for Pythonista http://omz-software.com/pythonista
import urllib
import webbrowser
URL_BASE = "drafts://x-callback-url/create?"
CALLBACK_URL_BASE = "pythonista://"
def do_action(actiontype,txt,cb=CALLBACK_URL_BASE):
surl = URL_BASE + 'text=' + urllib.quote(txt) + '&action=' + urllib.quote(actiontype) + '&x-success=' + urllib.quote(cb)
webbrowser.open(surl)
print "Action Complete"
def message(txt,cb=CALLBACK_URL_BASE):
do_action('Message',txt,cb)
# coding: utf-8
from objc_util import *
import console
import urllib
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@esprengle
esprengle / DownloadPhotosFromCloud.py
Created May 18, 2021 01:35 — forked from omz/DownloadPhotosFromCloud.py
DownloadPhotosFromCloud.py
# Quick workaround for photos module (Pythonista) not downloading photos from iCloud
import photos
from objc_util import ObjCClass, ObjCInstance, ObjCBlock
def download_cloud_asset(asset):
PHImageManager = ObjCClass('PHImageManager')
PHImageRequestOptions = ObjCClass('PHImageRequestOptions')
ph_asset = ObjCInstance(asset)
ph_image_mgr = PHImageManager.defaultManager()
@esprengle
esprengle / core_image.py
Created May 18, 2021 01:40 — forked from omz/core_image.py
core_image.py
'''
This module provides a Python wrapper around CIImage and CIFilter for using CoreImage filters from Pythonista more easily.
How to use:
1) Create a CImage object. The constructor accepts either a file path, a ui.Image, PIL.Image.Image, or photos.Asset object. Example:
>>> # From a photo:
>>> img = CImage(photos.pick_asset())
>>> # From a ui.Image:
@esprengle
esprengle / searchlink.rb
Created May 18, 2021 01:41 — forked from ttscoff/searchlink.rb
SearchLink creates Markdown links from automatic searches based on special syntax.
@esprengle
esprengle / mmdtagstomacos.rb
Created May 18, 2021 01:51 — forked from ttscoff/mmdtagstomacos.rb
Read MultiMarkdown metadata tags from files and apply them as macOS tags
#!/usr/bin/env ruby
# encoding: utf-8
#
# Read MultiMarkdown metadata tags from files and apply them as macOS tags
#
# Usage:
# mmdtagstomacos.rb *.md
require 'shellwords'
mmd = '/usr/local/bin/multimarkdown'