- editor config
- optimizing eero
# I always forget how to do this #######
# posix compliant
# if ! type poop &> /dev/null; then
# then
# echo "poop could not be found"
# exit
# fi
########################################
# other ways, but use the one above
# https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script
# https://unix.stackexchange.com/questions/86012/what-is-the-purpose-of-the-hash-command
# $ command -v foo >/dev/null 2>&1
# $ type foo >/dev/null 2>&1
# $ hash foo 2>/dev/null
# 2>/dev/null # only redirct errs
# &> /dev/null # redirect erything
########################################
TODO: still not happy with this setup; incorporate update-alternatives
binaries vs git pkgs
read this for the fkery
place binaries directly in ~/.local/share and symlink to /opt/bin
sudo ln -s ~/.local/share/CMD /opt/bin
place git repos in your git dir, make, and symlink to /opt/bin
sudo ln -s ~/git/whatev /opt/bin
^ allows you to keep /opt/bin owned by root, while keeping track of wtf you've downloaded as thats whats /opt is for
^ I think the recommened approach is to download to /opt directly, but whatev
^ or directly in /usr/local for opt packages, but fkn linux history n shit
- todos
- https://docs.aws.amazon.com/cli/latest/reference/configure/get.html
- https://vitux.com/test-your-internet-speed-through-ubuntu-command-line/
- https://shripadk.github.io/react/docs/jsx-gotchas.html
- https://iterationinsights.com/article/where-to-start-with-the-4-types-of-analytics/
- https://stackoverflow.com/questions/6656324/check-for-current-node-version
- https://www.redhat.com/sysadmin/linux-environment-variables
expect(some).toHaveBeenCalledWith( expect.objectContaining(someObject) );
import * as poop from '../some/folder' jest.Mock('../some/folder'); https://jestjs.io/docs/mock-functions poop.someFn.mockImplementation(async () => 'return this')
@see https://stackoverflow.com/questions/4937792/using-variables-inside-a-bash-heredoc
bash fn to curl some endpoint
register_no_pass() {
curl -X POST $SOME_URL
-H 'Content-Type: application/json; charset=utf-8'
-d @- << EOF
{
"field1": "value"
"field2": "$ANOTHER_VAR"
}
EOF
}
wifi iw dev # see network interfaces and what hteir connected to
-
[increasing file descriptors]https://docs.oracle.com/cd/E19476-01/821-0505/file-descriptor-requirements.html
$ ulimit -aH
see humand readabile limits
-
users, groups, and permissions
exec su -l $USER
reload session, e.g. to reload group assignments- x: execute 1
- w: write 2
- r: read 4
- and...
- read & execute: 5
- read & write: 6
- read & write & execute = 7
- what it means
- For files:
- r = read
- w = write
- x = execute
- For directories:
- r = list (read directory contents)
- w = write
- x = can access the directory (i.e., cd to the directory)
- For files:
-
system info (just use neofetch, but these are useful for scripting)
lsb_release -a
all infolsb_release -cs
e.g impishdpkg-architecture -q DEB_BUILD_ARCH
e.g. amd64, but can be used to query anythingdpkg --print-architecture
e.g. amd64grep '/usr/s\?bin' /etc/systemd/system/display-manager.service
find your display manager, e.g. gdm3lsmod | grep kvm
find the name of your hypervisorlshw -short
list hardware
-
files & disk
find ~/all/files/in/dir -type f -size +100k
tar -czvf as_this_file.tar.gz from_this_file
tar xvzf unzip_this_file.tar.gz -C to/this/dir
-
- find the cam from the list of devices
lsusb -t
- get some tape from one of your kitchen drawers
- and use the tape to cover the device you found in step 1
- find the cam from the list of devices
-
repos/packages
sudo add-apt-repository -r ppa:remove/this/ppa
sudo add-apt-repository ppa:add/this/ppa
sudo dpkg -i installme.deb
whereis somecmd
binary, source & man pages for a cmd
-
networking
hostname -I
your ipifconfig | grep inet
all your ips- whats on 80
lsof -i :80
- sudo apt install lsof
netstat -ltnp | grep -w :80
netstat -ltnp | grep -E ':80 |:443 '
- ^ notice the spaces, works better than the first
- sudo apt install net-tools
fuser 80/tcp
- sudo apt install psmisc
- the most concise
ps -p THE_PID -o comm=
- get the name of the process
cat /proc/net/tcp
- for embedded devices
-
ssh
eval \
ssh-agent -s`` start the ssh agentssh-add
add identities in~/.ssh
can also append a specific private keyssh-add -l
list identitiesid_rsa.pub
== your public key (share this)id_rsa
=== your private key
-
terminal
ctrl shift t
new tabtree --dirsfirst --charset=ascii SOME_DIR
show tree of dir
-
settings
sudo update-alternatives --config
choose the default cmd- set the default for common cmds
- x-terminal-emulator
- editor
- create a new cmd (e.g. in
/opt/bin/CMD
) that can be used to switch between multiple versionssudo update-alternatives --install ~/opt/bin/CMD CMD /some/path/to/actual/cmd 20
/opt/bin
is where the cmd will be installedCMD
is the name of the alternative to invoke the cmd/some/path/to/actual/cmd
is the path to the actual cmd20
is the priority of the alternative- repeat this for each cmd you want to use
- set the default for common cmds
-
aws
export AWS_DEFAULT_PROFILE=poop
aws configure list
safely list current aws configaws configure get aws_access_key_id
show the world your access key
-
- docker network ls
- docker inspect network some_network
-
eslint
- /eslint-disable/
- // eslint-disable-next-line
- // eslint-disable-line
dkms status sudo dkms remove 8814au -v 5.8.5.1 -k $(uname -r) sudo dkms uninstall rtl8814au -v 5.8.5.1 sudo rm -rf /usr/src/rtl8814au-5.8.5.1/ sudo rm -rf /usr/src/8814au-5.8.5.1/
use the --data-urlencode option
- inspect the response via jq
curl really-long-curl-options | jq .
aws_statemachine_run() {
# todo
aws stepfunctions start-execution help
# args:
# --state-machine-arn some_arn_from_aws
# --input file://some_file_path.json
}
# @see https://github.com/donnemartin/saws
aws_routetable_create() {
# $1 vpc-id
# $2 profile
# aws ec2 create-route-table --vpc-id $1 --profile $2
echo 'not setup'
}
aws_routetable_route_create() {
# $1 route table ID (make sure its the one attached to the subnet you want)
# $2 destination (ip cidr range)
# $3 this links it to an internet gateway
# ^ may have to update this fn in the future to specify a different target
# $4 profile name
# aws ec2 create-route --route-table-id $1 --destination-cidr-block $2 --gateway-id $3 --profile $4
echo 'not setup'
}
aws_internetgateway_create() {
# $1 profile
# aws ec2 create-internet-gateway --profile $1
echo 'not setup'
}
aws_tag_create() {
# $1 resource ids
# $2 tagKey e.g. Name
# $3 tagValue e.g. poop-dev
# $4 profile
# aws ec2 create-tags --resources $1 --tags Key=$2,Value=$3 --profile $4
echo 'not setup'
}
aws_routetable_link() {
# $1 route table id
# $2 subnet-id
# $3 profile
# aws ec2 associate-route-table --route-table-id $1 --subnet-id $2 --profile $3
echo 'not setup'
}
aws_internetgateway_link() {
# $1 gateway id
# $2 vpc id
# $3 profile
# aws ec2 attach-internet-gateway --internet-gateway-id $1 --vpc-id $2 --profile $3
echo 'not setup'
}
# todo: i need to setup named params before using any of this
aws_instance_run() {
# $1 ami-id
# $2 count of instances e.g. 1
# $3 instance type e.g. t2.micro
# $4 key pair name (rememer scoped to region)
# $5 subnet id
# $6 security group ids
# $7 user data, e.g. file://somefile.sh (ensure you use -y in the script)
# $8 profile to use
# $9 tag key e.g. Name
# $10 tag value e.g. poop-dev
# aws ec2 run-instances --image-id $1 --count $2 --instance-type $3 --key-name $4 --subnet-id $5 --security-group-ids $6 --user-data $7 --tag-specifications --profile $8 "ResourceType=instance,Tags=[{Key=$9,Value=$10}]"
echo 'not setup'
}
- checkout localstack
- curl manual
- jq manual
- nice review of jq, bash & curl
- good review of normal forms & normalization of sql schemas
- checkout kamon telemetry
- kuvebal validate k8s conf files
- down at the bottom theres a good review of unsetting envs vars on login
- zio intellij plugin
- postgres timestamp
- another bash loop discussion
- great refresher on bash loops
- add these aliases as bash fns
- CVE database
- scala for comprehension
- scala format
- create some bash fns for gitblame
- checkout obsidian.md
- mkcert: trusting local certs
- gitlab vars
- java http package
- httpclient ref
- another java11 http client walkthrough
- java 11 httpclient walkthrough
- scala duration
- java duration
- how to throw and handle execeptions
- httpClient sendAsync examples
- shading (programmatically rewriting) scala dependencies
- explicitly return unit value
- see sbt dependencies
- add an http server to any dir
- configuring global vs project intellij sdks
- mac git autocomplete
- multi-arch build and images
- asdf
- java PKIX ssl cert whatever the fk failure
- docker on apple silicon review
- docker apple silicon issues & resolutions
- sbt: specify main method/class to run
# prefix each line with a value
sed -e 's/^/0002,/' inthisfile.csv > copytothisfile.csv