Skip to content

Instantly share code, notes, and snippets.

View rot26's full-sized avatar
💬
is typing...

Chris rot26

💬
is typing...
  • Colorado, United States
View GitHub Profile
@rot26
rot26 / grep_xlsx_files.sh
Created May 31, 2019 14:33 — forked from modille/grep_xlsx_files.sh
Recursively find and grep through multiple Excel spreadsheets
# convert *.xlsx to *.xlsx.csv using https://github.com/dilshod/xlsx2csv
pip install xlsx2csv
# (shell-fu from http://stackoverflow.com/a/12965604)
find . -iname "*.xlsx" -exec sh -c 'xlsx2csv "$1" > "$1.csv"' x {} \;
# grep .csv files
brew install ripgrep
rg -i -g "*.csv" "waldo"
# ...or plain ole grep
@rot26
rot26 / rsync-this.sh
Last active December 18, 2018 18:09
[rsync-this] rsync all files in this directory to a target host #rsync #shell #bash #ssh
#!/usr/bin/env bash
# SheBang defaults to environment's bash
# Set bash debug
if [[ "$@" == *"--debug"* ]] || [ ${BASH_DEBUG} ]; then
export BASH_DEBUG=true
set -ex
fi
# Reference Path of this script
@rot26
rot26 / ssh-key-fingerprint.sh
Created November 6, 2018 19:33
[SSH Fingerprint (md5)] Get the md5 fingerprint of an ssh private key #ssh #keypair
#!/bin/bash
SSH_KEY="~/.ssh/id_rsa"
ssh-keygen -l -E md5 -f "${SSH_KEY}"
@rot26
rot26 / ssh-remove-a-known-host.sh
Created October 9, 2018 15:31
[ssh remove hostname] #ssh
# ssh-keygen -R hostname [-f known_hosts_file]
HOSTNAME=""
ssh-keygen -R "${HOSTNAME}"
@rot26
rot26 / objects-over-classes.md
Created October 7, 2018 16:21 — forked from indiesquidge/objects-over-classes.md
We are better off avoiding ES6 classes in JavaScript when possible

Plain JavaScript objects are better than classes when they can be used, and many popular modern frameworks have adopted their use.

Consider that in React a component can be created as either a class or as an object.

// using a class
class Welcome extends React.Component {
  render() {
 Hello, {this.props.name}
@rot26
rot26 / fuser.sh
Last active December 7, 2018 20:07
[process listening on port] 3 Ways to Find Out Which Process Listening on a Particular Port https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/ #networking #port #debug #ops
# Least recommended
#
# WARNING: Do not use delete flags with fuser! - Courtesy of ssolt
#
# Source:
# https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/
#
# $ sudo yum install psmisc #RHEL/CentOS
# $ sudo apt install psmisc #Debian/Ubuntu
# $ sudo dnf install psmisc #Fedora 22+
@rot26
rot26 / get-public-key.sh
Last active September 21, 2018 15:52
[Get Public key from private key] #ssh
# https://askubuntu.com/questions/53553/how-do-i-retrieve-the-public-key-from-a-ssh-private-key
# Example:
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
@rot26
rot26 / default-bash.sh
Last active July 14, 2019 21:06
[default bash script] #default #fav #bash #shell
#!/usr/bin/env bash
# SheBang defaults to environment's bash
# Set errexit / Do not continue on errors
set -e;
# Set bash debug
if [[ "$@" == *"--debug"* ]] || [ ${BASH_DEBUG} ]; then
export BASH_DEBUG=true;
set -x;
@rot26
rot26 / rsync-as-root-example.sh
Last active April 29, 2019 21:02
[rsync as root example] #rsync #sudo #root #scp #ssh
#rysnc as root by using `--rsync-path`
SOURCE_DIR="host-in-config:/path/to/copy"
DEST_DIR="/path/to/destination"
rsync \
--recursive \
--update \
--links
--rsync-path="sudo rsync" \
-e ssh \
@rot26
rot26 / .npmrc
Last active July 17, 2018 04:09
default npmrc
# Default npm flag settings
# Put this `.npmrc` file in your npm project root next to `package.json`
# Always save packages that get installed to avoid "missing dependencies"
save = true
# Always save the EXACT version that you ran and installed.
# upgrade to latest version on each new version (put `npm outdated` in your CI)
# `npm outdated && yarn upgrade --latest && npm outdated`
save-exact = true