Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / s3cp.sh
Last active September 29, 2020 19:26
Copy a directory structure from STDIN to AWS S3 bucket using aws s3 cp command AWS CLI
$#/bin/bash
# --acl bucket-owner-full-control is on by default
SECONDS=0
src=$1 # the path of the source directory
dest=$2 # the s3 bucket destination path
echo -e "Copying from ${src} to ${dest}\n"
for entry in "$src"/*; do
# getting the name of the file or directory

cp -av /Users/jason/Documents/* /Volumes/Pegasus2\ R8/Documents/ && sudo mv -v /Users/jason/Documents /Users/jason/Documents-$(date +%Y%m%d) && sudo ln -fvs /Volumes/Pegasus2\ R8/Documents/ /Users/jason/Documents

Keybase proof

I hereby claim:

  • I am jfeilbach on github.
  • I am argonaut (https://keybase.io/argonaut) on keybase.
  • I have a public key ASDSqaQKiPfTfZNrMA2xRwqpUDaYvKmuso9DBDqK7b6lcwo

To claim this, I am signing this object:

@jfeilbach
jfeilbach / cheat.md
Last active March 14, 2023 23:52
super fast tail to web cheat using netcat

tail log file to web via netcat

Server side

sudo yum install nc -y && (echo -e ‘HTTP/1.1 200 OK\nAccess-Control-Allow-Origin: *\nContent-type: text/event-stream\n’ && tail -f /var/log/squid/access.log | grep 10.120.13.31| sed -u -e ‘s/^/data: /;s/$/\n/’) | nc -l 8000

Client browser

new EventSource("http://${server}:8000/").onmessage = function(e) {
  console.log(e.data);
};
@jfeilbach
jfeilbach / get_promise_info.sh
Last active May 4, 2024 15:36
Promise Utility information dump
#!/bin/bash
# Dump information, logs, and stats about Promise disk array uing the Promise Utility cli
date=$(date +%Y-%m-%d)
log=~/Documents/promise-${date}.log
cmd='/usr/local/bin/promiseutil -L ${log} -C'
syslog='hostname'
echo -e "\nWill write to ${log}\n"
@jfeilbach
jfeilbach / grub.md
Last active July 1, 2025 15:09
Make Linux fast

In /etc/default/grub, modify:

noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off 

Then sudo update-grub

from https:// make-linux-fast-again.com/ This domain does not seem to be maintained any longer.

@jfeilbach
jfeilbach / gist:5094351d08c9ac1824aafdee64f2f3c0
Created April 5, 2020 04:44
get bitrate and convert to kilobits per second
val=$(ffprobe -v error -show_entries format=bit_rate -of default=noprint_wrappers=1:nokey=1 input.mkv)
echo "$(($val / 1000))" kb/s
@jfeilbach
jfeilbach / authorized_keys.sh
Created April 3, 2020 22:48
authorized_keys.sh
#!/bin/bash
# Version 1.0
# 2019-02-06
set -o errexit
set -o nounset
set -o pipefail
#set -x # remove '#' at start of this line for super-verbose debugging
BUCKET_NAME=""
@jfeilbach
jfeilbach / htoprc
Created March 22, 2020 19:22
cp /boot/extra/htoprc /root/.config/htop/htoprc for unRAID
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=1
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
show_thread_names=0
@jfeilbach
jfeilbach / readopt.sh
Last active May 24, 2020 05:33
manually readopt all switches and access points on LAN if controller lost
#!/bin/bash
# version 1.2
# removed 192.168.1.11
# removed 192.168.1.14
# Readopt UniFi devices by UniFi controller
# The set-inform command is an alias on the remote host. Obviously we don't have the same env as a remote ssh login. The same is true for the info command.
# set-inform='mca-cli-op set-inform'
# info='mca-cli-op info'
addr='192.168.1.'