Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
#!/usr/bin/env python | |
import os | |
import sys | |
import subprocess | |
if len(sys.argv) > 1: | |
files = [] | |
for arg in sys.argv[1:]: | |
if os.path.exists(arg): | |
p = os.path.abspath(arg).replace('\\', '\\\\').replace('"', '\\"') |
// -- app.js -- | |
import { AbstractNode } from './internal' | |
/* as is */ | |
// -- internal.js -- | |
export * from './AbstractNode' | |
export * from './Node' | |
export * from './Leaf' |
import Foundation | |
import AppKit | |
import AVFoundation | |
extension NSImage { | |
@objc var CGImage: CGImage? { | |
get { | |
guard let imageData = self.tiffRepresentation else { return nil } | |
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil } | |
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil) |
import Foundation | |
import AppKit | |
import AVFoundation | |
extension NSImage { | |
@objc var CGImage: CGImage? { | |
get { | |
guard let imageData = self.tiffRepresentation else { return nil } | |
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil } | |
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil) |
The dynamic wallpaper in MacOS Mojave is a single 114 MB .heic
file that seems to contain 16 embedded images.
It also contains the following binary plist data in its metadata under the key "Solar". It's an array of 16 items, each with four keys:
i
(integer). This seems to be the image index.o
(integer). This is always 1 or 0. Stephen Radford thinks it indicates dark mode (0) vs. light mode (1).a
(decimal). I’m pretty sure this is the angle of the sun over the horizon. 0º = sunset/sunrise. 90º = sun directly overhead. Negative values = sun below horizon.z
(decimal). This seems to be the cardinal position of the sun relative to the camera. 0º = sun is directly in front of the camera. 90º = sun is directly to the right of the camera. 180º = sun is directly behind the camera.#!/bin/bash | |
# Script to backup git repo to Backblaze B2 | |
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars | |
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc | |
# Ensure you have authorized the B2 command line tool with the correct account AND added your SSH | |
# public key to your github account, if you need to backup private repositories. | |
# To restore this repo in the future, download it from B2, extract it and then use this command: | |
# cd old-repository.git |
by Jenny Knuth, based on the work of Chris Coyier and Taylor Hunt
A data URI is a nice way to include a web resource without needing to make an HTTP request. Chris Coyier explains the technique nicely in Probably Don't Base64 SVG.
While a PNG might use Base64 encoding, for SVG, there is a better way.
Taylor Hunt's experiments led to this solution for optimizing SVGs in data URIs:
"So the best way of encoding SVG in a data URI is data:image/svg+xml,[actual data]
. We don’t need the ;charset=utf-8
parameter (or the invalid ;utf8
parameter…), because URLs are always ASCII."
A list of useful commands for the FFmpeg command line tool.
Download FFmpeg: https://www.ffmpeg.org/download.html
Full documentation: https://www.ffmpeg.org/ffmpeg.html