Skip to content

Instantly share code, notes, and snippets.

@nejni-marji
nejni-marji / element_text.py
Created May 11, 2020 21:29
convert words by using the periodic table of elements (symbol -> atomic number) as a hash
#!/usr/bin/env python3
from sys import argv
# written by nejni-marji
# Elem Hash
eh = { "h": "1", "he": "2", "li": "3", "be": "4", "b": "5", "c": "6", "n": "7", "o": "8", "f": "9", "ne": "10", "na": "11", "mg": "12", "al": "13", "si": "14", "p": "15", "s": "16", "cl": "17", "ar": "18", "k": "19", "ca": "20", "sc": "21", "ti": "22", "v": "23", "cr": "24", "mn": "25", "fe": "26", "co": "27", "ni": "28", "cu": "29", "zn": "30", "ga": "31", "ge": "32", "as": "33", "se": "34", "br": "35", "kr": "36", "rb": "37", "sr": "38", "y": "39", "zr": "40", "nb": "41", "mo": "42", "tc": "43", "ru": "44", "rh": "45", "pd": "46", "ag": "47", "cd": "48", "in": "49", "sn": "50", "sb": "51", "te": "52", "i": "53", "xe": "54", "cs": "55", "ba": "56", "la": "57", "ce": "58", "pr": "59", "nd": "60", "pm": "61", "sm": "62", "eu": "63", "gd": "64", "tb": "65", "dy": "66", "ho": "67", "er": "68", "tm": "69", "yb": "70", "lu": "71", "hf": "72", "ta": "73", "w": "74", "re": "75", "os": "76", "ir": "77", "pt": "78", "au": "79", "hg": "8
@nejni-marji
nejni-marji / notes.txt
Created August 27, 2019 14:22
what if i3bar showed ALL workspaces regardless of output
In the actual config for this, these would be 4 color settings in the bar block. Here I'm just using symbols instead.
[n] is focused, on this ws
n is unfocused, on this ws
<n> is focused, on another ws
(n) is unfocused, on another ws
output 1 workspaces:
1 [2] 4
output 2 workspaces:
[3] 5 6
@nejni-marji
nejni-marji / README.txt
Last active August 25, 2019 21:15
while loops and wttr.in metascript (has README)
# Setting up `whileread.zsh` is special because it checks its own filename to
# know how to behave. You can put the actual file anywhere you want, just
# symlink it correctly.
ln -s whileread.zsh ~/bin/whread.zsh
ln -s whileread.zsh ~/bin/whless.zsh
# Usage for wttr.in.zsh:
wttr.in.zsh [ LOCATION [ FLAGS [ LANG [ DELAY ]]]]
Location, flags, and lang specs can be found at `wttr.in/:help`
The location can be empty string (put '' or "" instead of a name)
#!/bin/zsh
i3-msg 'workspace 1'
compton -b
sleep 0.1
# script runs i3-msg 'append_layout' and then opens some applications
~/Dotfiles/extras/i3wm/gen_wsmeta.zsh
sleep 1
i3-msg restart
@nejni-marji
nejni-marji / flipsplit.zsh
Last active August 12, 2019 01:17
tool to swap between splits and tabs/stacks in i3wm
#!/bin/zsh
#
# flipsplit.zsh
#
# {{{ help text
show_help() {
>&2 <<-EOM
Usage: $0 STYLE [WORKSPACE]
STYLE can be either 'split' or 'merge'.
@nejni-marji
nejni-marji / mgrep
Created April 10, 2019 00:20
grep for lines that contain multiple patterns in any order, using 2 passes of grep
#!/bin/zsh
re1="^($(
for i in "${@[@]}" ;
do echo -n "(?=.*($i).*\$)" ;
done
))"
re2="($(
echo "${(F)@}" | paste -s -d '|'
# Authored by nejni-marji
# Text art made by this website:
# https://manytools.org/hacker-tools/convert-image-to-ansi-art/go
$the_cow = <<"EOC";
$thoughts
$thoughts
$thoughts
$thoughts ▒▓▓▓▓▓
$thoughts ▓▓▒▒▒▒▒▒▒▒▒▒▒
$thoughts ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
#
# ~/.i3/config
#
# vim:fdm=marker:
# i3 config file (v4)
bindsym $MOD+o $exec ~/dropdown_term.sh
for_window [title="^dropdown$"] floating enable
@nejni-marji
nejni-marji / dropdown_term.sh
Last active March 10, 2019 01:25
dropdown terminal for i3?
#!/bin/bash
#
# dropdown_terminal.sh
#
# Usage: dropdown_terminal.sh
# Just call it to open the terminal, call it again to close it.
#
# If you're familliar with tmux, it also sets a session group, so maybe this
# could be extended to utilize those in some way, but I'm probably not going
@nejni-marji
nejni-marji / keynav-cli.sh
Created March 7, 2019 23:04
keynav magic
#!/bin/bash
if pgrep -xf 'keynav daemonize' >/dev/null; then
pkill -xf 'keynav daemonize'
keynav "$@"
keynav daemonize
fi