Skip to content

Instantly share code, notes, and snippets.

View nuclearglow's full-sized avatar

Sven Vowe nuclearglow

View GitHub Profile
@nuclearglow
nuclearglow / convert-arraybuffer.js
Created January 26, 2018 10:30
ArrayBuffer <-> JSON <-> ArrayBuffer
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));
// send around
// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer
@nuclearglow
nuclearglow / settings.json
Last active February 22, 2023 12:36
2023 VSCode settings
{
// adjust font sizes here
"terminal.integrated.fontSize": 13,
"debug.console.fontSize": 13,
"debug.console.lineHeight": 16,
"editor.fontSize": 13,
// Language specific settings
"html.autoClosingTags": true,
"[typescript]": {
"editor.codeActionsOnSave": {
https://askubuntu.com/questions/1404550/google-chrome-freeze-uploading-a-file
sudo apt install xdg-desktop-portal-gnome
@nuclearglow
nuclearglow / alacritty-terminfo.sh
Created June 8, 2022 08:00
Alacritty install terminfo
wget https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info && tic -xe alacritty,alacritty-direct alacritty.info && rm alacritty.info
@nuclearglow
nuclearglow / History|-10f7f58c|entries.json
Last active April 25, 2022 19:06
vscode-settings-sync
{"version":1,"resource":"file:///home/nuky/workspace/application/appserver/src/runtime/uiEngine/__tests__/uienginev3.spec.ts","entries":[{"id":"tc4Z.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650372563334},{"id":"xVgr.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650373365402},{"id":"TXTD.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650373391203},{"id":"I4Ze.ts","timestamp":1650375842181},{"id":"dJDC.ts","timestamp":1650375879715},{"id":"7Qo2.ts","timestamp":1650375902945},{"id":"sNXC.ts","timestamp":1650375947275},{"id":"Cf6g.ts","timestamp":1650375973805},{"id":"uy9R.ts","timestamp":1650375991510},{"id":"tCHj.ts","timestamp":1650376010063},{"id":"OGEq.ts","timestamp":1650382238870},{"id":"Ol3S.ts","timestamp":1650382289794},{"id":"KMkg.ts","timestamp":1650382306407},{"id":"58at.ts","timestamp":1650382342093},{"id":"aHFv.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650382408517},{"id":"uZzv.ts","source":"Fix all ESLint auto-fixa
@nuclearglow
nuclearglow / tmux-keybindings.md
Last active April 5, 2022 20:01
tmux keybindings

tmux expand window to full screen

:resize-window -A

tmux new session

:new -s

Restoring previously saved environment

None of the previous saves are deleted (unless you explicitly do that). All save files are kept in ~/.tmux/resurrect/ directory.

@nuclearglow
nuclearglow / gist:640069238ace4f8fc34fb852d6eff3d1
Last active March 29, 2022 21:11
record key sequence linux cli showkey to \u sequence
showkey -a
example:
ctrl+pgup
^[[5;5~ 27 0033 0x1b
91 0133 0x5b
53 0065 0x35
59 0073 0x3b
@nuclearglow
nuclearglow / ffmpeg.md
Last active January 7, 2022 10:47
MP4, WebM and Animated GIFs

Install Mac OS X

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc brew install gifify

Install Ubuntu

sudo apt-get install ffmpeg libavcodec-extra

Extract slice and convert to GIF

ffmpeg -ss 30 -t 3 -i input.mp4 -vf "fps=25,scale=320:-1:flags=lanczos" -loop 0 output.gif

@nuclearglow
nuclearglow / postgresql-drop-all-schemas.sql
Last active December 10, 2021 16:21
PostgreSQL: Drop all schemas
DO $$ DECLARE
namespace RECORD;
BEGIN
FOR namespace IN (SELECT s.nspname as schema from pg_catalog.pg_namespace s where nspname not in ('information_schema', 'pg_catalog', 'public', 'everest') and nspname not like 'pg_%')
LOOP
EXECUTE 'DROP SCHEMA IF EXISTS ' || quote_ident(namespace.schema) || ' CASCADE';
END LOOP;
END $$;
@nuclearglow
nuclearglow / gist:fabd8d169682a21f059b86750bc6dd00
Created April 7, 2021 20:53
Ubuntu Backup and Restore all packages installed
# backup the sources.list file !
# backup
apt-mark showmanual > .installed_ubuntu_packages
# on another system
# restore sources.list file !
xargs < .installed_ubuntu_packages apt-get install -y
ä old school way
# backup the sources.list file !