Skip to content

Instantly share code, notes, and snippets.

@idcrook
idcrook / client.md
Created March 6, 2022 20:41
quick and dirty copy files from a directory on a remote host python3 built-in
wget -r http://192.168.1.2:8080/
@idcrook
idcrook / app_icon_model.scad
Last active July 1, 2020 18:29
Improved version of attempt at reverse engineering Xcode 12 Instruments icon, modeled in OpenSCAD
// 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 July 1, 2020 07:18
Recreate mesh of Instruments
#!/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 18:49
macOS emacs emoji font settings
@idcrook
idcrook / lang-web.el
Created August 28, 2018 15:18
rsjx mode with attempt at auto-detecting JSX files
(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")
# /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 October 18, 2023 21:31
Configure homebridge-camera-ffmpeg homebridge plugin for USB-attached webcam
{
"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 June 13, 2018 16:12
Emacs magit-status kill associated buffers (instead of just burying)
;; 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 August 17, 2018 20:28
Shell command line expansion from kubernetes aliases; even complete in system namespace if bash alias uses that
# 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 June 13, 2018 15:06
emacs neotree and projectile: sync with projectile
;; 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