type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------- | |
THE INSANE POWER OF VIM'S GLOBAL COMMAND | |
Joe Ellis | |
Last edited: Sun 10 Oct 2021 21:18:45 BST | |
-------------------------------------------------------------------------------- | |
If you're an advanced Vim user, you've probably already used the `:global` | |
command. It allows you to to execute an Ex command on a set of lines where a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# extend non-HiDPI external display on DP* above HiDPI internal display eDP* | |
# see also https://wiki.archlinux.org/index.php/HiDPI | |
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949 | |
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319 | |
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1` | |
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1` | |
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Export database in gzip form | |
mysqldump -u user -p database | gzip > database.sql.gz | |
// Import database from gzip form | |
gunzip < database.sql.gz | mysql -u user -p database |
Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store
. For more information about GPG, consult the GNU Privacy Handbook.
To get started, install pass
and generate a keypair.
$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap <silent> <leader>e :call Fzf_dev()<CR> | |
" ripgrep | |
if executable('rg') | |
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"' | |
set grepprg=rg\ --vimgrep | |
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0) | |
endif | |
" Files + devicons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========================================== ========================================== | |
TMUX COMMAND WINDOW (TAB) | |
========================================== ========================================== | |
List tmux ls List ^b w | |
New -s <session> Create ^b c | |
Attach att -t <session> Rename ^b , <name> | |
Rename rename-session -t <old> <new> Last ^b l (lower-L) | |
Kill kill-session -t <session> Close ^b & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
NewerOlder