Skip to content

Instantly share code, notes, and snippets.

@esprengle
esprengle / .ideavimrc
Created September 12, 2021 17:45 — forked from dewaka/.ideavimrc
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" Copy to system clipboard as well
set clipboard+=unnamed
@esprengle
esprengle / bot_example.py
Created July 16, 2021 20:56 — forked from EvieePy/bot_example.py
A Cogs Example for the rewrite version of - discord.py
import discord
from discord.ext import commands
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic
understanding and platform for creating your own bot.
These examples make use of Python 3.6.2 and the rewrite version on the lib.
@esprengle
esprengle / Tour de France Profile.js
Created July 15, 2021 00:49 — forked from simonbs/Tour de France Profile.js
Scriptable script showing a profile of the current Tour de France stage
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: yellow; icon-glyph: bicycle;
let stages = await loadStages()
let stage = findStage(stages)
if (stage == null) {
let widget = createTournamentOverWidget()
await widget.presentMedium()
} else {
let stageDetails = await loadStageDetails(stage.id)
"""
Taken from
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
and sorted.
Python's own `mimetypes.guess_extension` is pretty useless, eg. "text/plain" maps to the ".bat" extension.
"""
content_types = {
'application/epub+zip': '.epub',
@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'
@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 / 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 / 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()
# 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 / 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)