Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

David Crook idcrook

🏠
Working from home
View GitHub Profile
@idcrook
idcrook / app_icon_model.scad
Last active Jul 1, 2020
Improved version of attempt at reverse engineering Xcode 12 Instruments icon, modeled in OpenSCAD
View app_icon_model.scad
// Reverse-engineer model an Xcode 12 Instruments icon mesh in OpenSCAD
// idcrook@users.noreply.github.com
// Inspired to create by
// https://twitter.com/edwardsanchez/status/1278152030645698560
// Turn on Animate in App menu bar
// [x] Check Dump Pictures
// - creates files in sequence frame00000.png
// - Select FPS: 12 and Steps: 60
@idcrook
idcrook / anim.sh
Last active Jul 1, 2020
Recreate mesh of Instruments
View anim.sh
#!/bin/bash -x
for j in `seq 0 144`;do
i=`printf "%04d" $j`
r=`expr 5 \* $j`
openscad -o logo_anim-$i.png app_icon_model.scad --preview --camera=0,0,0,90,0,$r,415 --colorscheme="Tomorrow Night" --projection=o
done
@idcrook
idcrook / base-platform-snippet.el.md
Last active May 7, 2019
macOS emacs emoji font settings
View base-platform-snippet.el.md
@idcrook
idcrook / lang-web.el
Created Aug 28, 2018
rsjx mode with attempt at auto-detecting JSX files
View lang-web.el
(use-package rjsx-mode
:mode "\\.jsx$"
:mode "components/.+\\.js$"
:init
;; auto-detect JSX file
;; https://github.com/shahinism/emacs.d/blob/master/configs.org
;; source: https://github.com/hlissner/.emacs.d/blob/master/modules/lang/javascript/config.el
(push (cons (lambda ()
(and buffer-file-name
(equal (file-name-extension buffer-file-name) "js")
View homebridge.service
# /etc/systemd/system/homebridge.service -*- systemd -*-
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
@idcrook
idcrook / homebridge-camera-ffmpeg snippet config.json
Last active Aug 27, 2018
Configure homebridge-camera-ffmpeg homebridge plugin for USB-attached webcam
View homebridge-camera-ffmpeg snippet config.json
{
"platform": "Camera-ffmpeg",
"videoProcessor": "/usr/local/bin/ffmpeg",
"cameras": [
{
"name": "BasementCam",
"videoConfig": {
"source": "-re -f v4l2 -video_size 1280x720 -i /dev/video0",
"stillImageSource": "-f video4linux2 -input_format mjpeg -video_size 1280x720 -ss 0.9 -i /dev/video0 -frames:v 1",
"maxStreams": 2,
@idcrook
idcrook / magit-kill-buffers.el
Created Jun 13, 2018
Emacs magit-status kill associated buffers (instead of just burying)
View magit-kill-buffers.el
;; based on http://manuel-uberti.github.io/emacs/2018/02/17/magit-bury-buffer/
;; had to deviate from it since:
;; 1. the post's key bind code did not work for me
;; 2. added late loading, otherwise magit-status-mode-map undefined
;; 3. 'q' was already bound by magit, so use 'Q' instead of rebinding
(defun idc-magit-kill-buffers ()
"Restore window configuration and kill all (of these) Magit buffers."
(interactive)
(let ((buffers (magit-mode-get-buffers)))
(magit-restore-window-configuration)
@idcrook
idcrook / bashrc_kubernetes_alias_completions.sh
Last active Aug 17, 2018
Shell command line expansion from kubernetes aliases; even complete in system namespace if bash alias uses that
View bashrc_kubernetes_alias_completions.sh
# source kubectl bash completions
if hash kubectl 2>/dev/null; then
source <(kubectl completion bash)
fi
# the magic via https://github.com/cykerway/complete-alias
# seems to require BASH 4; install bash from Homebrew and make its BASH 4 the default user shell in macOS
# mkdir ~/.bash_completion.d
# curl -o ~/.bash_completion.d/bash_complete-alias.sh https://raw.githubusercontent.com/cykerway/complete-alias/master/completions/bash_completion.sh
if [ -f ~/.bash_completion.d/bash_complete-alias.sh ] ; then
@idcrook
idcrook / neotree-project-dir.el
Created Jun 13, 2018
emacs neotree and projectile: sync with projectile
View neotree-project-dir.el
;; NeoTree can be opened (toggled) at projectile project root
(defun neotree-project-dir ()
"Open NeoTree using the git root."
(interactive)
(let ((project-dir (projectile-project-root))
(file-name (buffer-file-name)))
(neotree-toggle)
(if project-dir
(if (neo-global--window-exists-p)
(progn
@idcrook
idcrook / use-package_neotree.el
Last active Sep 18, 2018
neotree 26.1 display-line-numbers-mode
View use-package_neotree.el
;; sidebar and dired in one
(use-package neotree
:bind
("<f8>" . neotree-toggle)
:config
;; needs package all-the-icons
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
;; Disable line-numbers minor mode for neotree
(add-hook 'neo-after-create-hook
You can’t perform that action at this time.