In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py
)
Save and open the script in your editor of choice.
/* Useful celery config. | |
app = Celery('tasks', | |
broker='redis://localhost:6379', | |
backend='redis://localhost:6379') | |
app.conf.update( | |
CELERY_TASK_RESULT_EXPIRES=3600, | |
CELERY_QUEUES=( | |
Queue('default', routing_key='tasks.#'), |
;; Taken from https://andreyor.st/posts/2020-05-10-making-emacs-tabs-look-like-in-atom/ | |
;; https://github.com/andreyorst/dotfiles/blob/740d346088ce5a51804724659a895d13ed574f81/.config/emacs/README.org#tabline | |
(defun my/set-tab-theme () | |
(let ((bg (face-attribute 'mode-line :background)) | |
(fg (face-attribute 'default :foreground)) | |
(hg (face-attribute 'default :background)) | |
(base (face-attribute 'mode-line :background)) | |
(box-width (/ (line-pixel-height) 4))) | |
(set-face-attribute 'tab-line nil |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.
C-M-f | sp-forward-sexp |
C-M-b | sp-backward-sexp |
# SNAKES GAME | |
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting | |
import curses | |
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
from random import randint | |
curses.initscr() | |
win = curses.newwin(20, 60, 0, 0) |
brew install ImageMagick
ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %04d.png
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
# coding=utf8 | |
import PIL | |
from PIL import ImageFont | |
from PIL import Image | |
from PIL import ImageDraw | |
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200): | |
REPLACEMENT_CHARACTER = u'\uFFFD' | |
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' ' |