Skip to content

Instantly share code, notes, and snippets.

View axelav's full-sized avatar
🕸️

Axel Anderson axelav

🕸️
View GitHub Profile
@fr0der1c
fr0der1c / delete_unused_assets.py
Created December 22, 2022 09:20
Logseq find unused assets & find missing assets
import os
import shutil
assets_dir = './assets'
journal_dir = './journals'
pages_dir = './pages'
to_delete_dir = './to_delete'
def get_all_assets() -> list[str]:
@amancevice
amancevice / commit-msg
Last active March 23, 2021 11:12
A git hook for mining Amulets https://text.bargains/amulet/
#!/bin/sh
# .git/hooks/commit-msg
chksum="$( printf "%s" "$(< $1)" | sha256sum )"
amulet="\e[5;1;48mYOU HAVE FOUND %s AMULET\e[0m\n"
if grep 8888888888 > /dev/null <<< $chksum ; then
printf "$amulet" "AN IMPOSSIBLE"
elif grep 888888888 > /dev/null <<< $chksum ; then
printf "$amulet" "A MYTHIC"
elif grep 88888888 > /dev/null <<< $chksum ; then
printf "$amulet" "A LEGENDARY"
@axelav
axelav / localStorage-polyfill.js
Last active January 23, 2018 00:14 — forked from juliocesar/best-localStorage-polyfill-evar.js
This is the best localStorage polyfill in the world
if (!('localStorage' in window)) {
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; },
removeItem : function(id) { return delete this._data[id]; },
clear : function() { return this._data = {}; }
};
}
@max-mapper
max-mapper / bibtex.png
Last active March 10, 2024 21:53
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@johnelliott
johnelliott / aws-instances.alias.sh
Last active April 21, 2017 01:08
AWS instances
# requires ~/.aws/config or $ aws configure to work
alias inst="aws ec2 describe-instances --output text|grep INSTANCES|cut -f10,14|sort"
@csswizardry
csswizardry / README.md
Last active June 16, 2024 13:44
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@paulirish
paulirish / what-forces-layout.md
Last active July 23, 2024 15:12
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@gerbsen
gerbsen / ssh_agent_start.fish
Last active July 16, 2024 16:52 — forked from schaary/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
# content has to be in .config/fish/config.fish
# if it does not exist, create the file
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
echo "Initializing new SSH agent ..."
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
echo "succeeded"
chmod 600 $SSH_ENV
. $SSH_ENV > /dev/null
@max-mapper
max-mapper / readme.md
Last active May 21, 2022 11:02
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera