Discover Snippets

@dd86k dd86k / .bashrc Created at Thu Feb 15 13:13:42 UTC 2024
Bash preferences
# Bash 4 and later
command_not_found_handle () {
printf "command not found\n"
return 127
}
@dd86k dd86k / divref.md Created at Tue Jul 04 12:34:16 UTC 2023
Quick Division Reference

Quick Division Reference

Division/Multiply Shift Note
2 1 64 / 2 == 32 == 64 >> 1
4 2 64 / 4 == 16 == 64 >> 2
8 3
16 4
32 5
64 6
@dd86k dd86k / usbpower.md Created at Fri Jun 30 13:53:16 UTC 2023
USB Power Cheatsheet

USB Power Cheatsheet

Author Year Specification Power (max) Voltage Current
USB-IF 2000 USB 2.0 2.5 W 5 V 500 mA
USB-IF 2008 USB 3.0 4.5 W 5 V 900 mA
USB-IF 2008 USB 3.0 Battery Charging 7.5 W 5 V 1.5 A
USB-IF 2012 USB 3.1 Power Delivery 1.0 100 W 20 V 5 A
USB-IF 2014 USB Power Delivery 2.0 100 W 20 V 5 A
USB-IF 2015 USB Power Delivery 3.0 100 W 20 V 5 A
@dd86k dd86k / easy-zerofree.sh Created at Tue Feb 14 11:58:55 UTC 2023
Zerofree
#!/bin/bash

# $1 = Type, like ext4
# $2 = Drive, like /dev/sda1

systemctl stop systemd-journal*
swapoff -a
mount -n -o remount,ro -t $1 $2 /
zerofree -v $2
@dd86k dd86k / asterisk.service Created at Fri Jan 06 16:37:06 UTC 2023
Asterisk systemd Unit file
[Unit]
Description=Asterisk
After=network.target

[Service]
Type=simple
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecReload=/usr/sbin/asterisk -rx 'core reload'
@dd86k dd86k / mpv.conf Created at Fri Oct 07 10:26:04 UTC 2022
WHEEL_UP    add volume 2
WHEEL_DOWN  add volume -2
@dd86k dd86k / getcmdline.d Created at Fri Apr 22 19:00:30 UTC 2022
A simple GetCommandLineW-x86 implementation. Works from Windows XP to 11 thanks to the instroduction of TLS.
wchar* GetCommandLineWFast() {
version (X86_64) asm {
mov RAX,GS:[0x60];
mov RAX,[RAX+0x20];
mov RAX,[RAX+0x78];
} else version (X86) asm {
mov EAX,FS:[0x30];
mov EAX,[EAX+0x10];
mov EAX,[EAX+0x44];
}
@dd86k dd86k / .nanorc Created at Sat Sep 04 21:32:14 UTC 2021
Nano user configuration file
set constantshow
set linenumbers
set nonewlines
set noconvert
set smarthome
set nohelp
set minibar
#set mouse
#bind ^C copy main
#bind ^V paste all
@dd86k dd86k / vscode.json Created at Mon Apr 19 08:04:52 UTC 2021
VSCode settings
{
"breadcrumbs.enabled": true,
"debug.internalConsoleOptions": "neverOpen",
"diffEditor.ignoreTrimWhitespace": false,
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.accessibilitySupport": "off",
"editor.autoClosingBrackets": "never",
"editor.autoClosingQuotes": "never",
"editor.autoSurround": "never",
@dd86k dd86k / git_aliases Created at Tue Mar 02 09:18:24 UTC 2021
My Git aliases
git config --global alias.c checkout
git config --global alias.b branch
git config --global alias.p push
git config --global alias.s status
git config --global alias.d diff
git config --global alias.pp "pull -p"
git config --global alias.fp "fetch -p"
git config --global alias.oops "reset --soft HEAD~1"
git config --global alias.graph "log --all --graph --oneline"
git config --global alias.conflicts "diff --name-only --diff-filter=U"