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
# Adjust sensitivity for logitech mouse | |
# xinput list | |
# xinput list-props 17 | |
xinput set-prop 17 144 0.400000, 0.000000, 0.000000, 0.000000, 0.400000, 0.000000, 0.000000, 0.000000, 1.000000 | |
# Scroll speed | |
xinput set-prop 17 'Evdev Scrolling Distance' 1.9 1 1 |
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
cryptsetup luksOpen /dev/nvme0n1p2 cryptkey | |
cryptsetup luksOpen --key-file=/dev/mapper/cryptkey /dev/nvme0n1p3 cryptswap | |
cryptsetup luksOpen --key-file=/dev/mapper/cryptkey /dev/nvme0n1p4 cryptroot | |
#+END_SRC | |
Then for a not fun bit, matching entries in =/dev/disk/by-uuid/= to | |
the partitions we want to mount where. Running ~ls -l | |
/dev/disk/by-uuid/~ shows which devices have which UUIDs. To determine | |
what =dm-1= and =dm2=, I ran ~ls -la /dev/mapper~: |
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
function print_fequency() { | |
(echo "Package Frequency" ; \ | |
cat | tr ' ' '\n' | sort | uniq -c | awk '{print $2"\t"$1}') | column -t | |
} | |
# https://github.com/dominikh/go-unused | |
function find_unused() { | |
unused -exported "${1}/..." | |
} |
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
#!/usr/bin/env bash | |
function req() { | |
what=$1 | |
which "${what}" >/dev/null || { echo "${what} required"; exit 1; } | |
} | |
req curl | |
req gcc |
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
#!/usr/bin/env python3 | |
""" | |
I have an ordered historical list of daily prices of quizlet coin - the hot new cryptocurrency. | |
[100, 50, 120, 100, 300, 250, 1] | |
What is the best profit I could have made from 1 purchase and 1 sale of Quizlet Coin? |
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
# Ref: https://github.com/SergK/cheatsheat-tcpdump/blob/master/tcpdump_advanced_filters.txt | |
# Ref: http://edoceo.com/cli/tcpdump | |
HTTP_PORT="8444" | |
HTTP_FILTER="(((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | |
tcpdump -i any -s 0 -A "tcp port $HTTP_PORT and $HTTP_FILTER" |
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
# More on Performance | |
# Ref: https://unix.stackexchange.com/questions/41740/find-exec-vs-find-xargs-which-one-to-choose | |
# Ref: https://www.everythingcli.org/find-exec-vs-find-xargs | |
# Find all files, including hidden, that match the name "config" | |
find . -type f -name config | |
# Find all files that contain the word "git" in the filename | |
find . -type f -iname '*git*' |
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
SD_CARD="/dev/disk1000" | |
LOCAL="~/Desktop/2013-09-25-wheezy-raspbian-minimal.img" | |
# First, unmount the disk | |
diskutil unmountDisk ${SD_CARD} | |
# If you are writing from SD card to Mac, calculate the number of bytes to skip as well as the size to pipe to pv. | |
# 5785600 bytes (count) * 512 (default bs) = 2962227200 bytes == 2825 Megabytes | |
dd if=${SD_CARD} count=5785600 | pv -s 2825M | dd of=${LOCAL} count=5785600 |
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
# Robust curl command to retry, timeout, and save the output to a file | |
curl --silent --show-error \ | |
--location --max-redirs 3 \ | |
--retry 3 --retry-connrefused --retry-delay 2 \ | |
--max-time 30 \ | |
"$url" |
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/bash | |
# Translate dmesg timestamps to human readable format | |
# desired date format | |
date_format="%Y-%m-%dT%H:%M:%SZ" | |
# [ 3.469072] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null) | |
# [ 3.483769] dracut: Remounting /dev/disk/by-label/\x2f with -o noatime,ro | |
# [ 3.495019] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null) | |
# [ 3.506417] dracut: Mounted root filesystem /dev/xvda1 |
OlderNewer