Skip to content

Instantly share code, notes, and snippets.

View chadmayfield's full-sized avatar

Chad Mayfield chadmayfield

View GitHub Profile
@chadmayfield
chadmayfield / expected_behavior.txt
Created February 11, 2019 23:15
rename_season.sh: a simple TV season renamer to rename DVR'ed season more in-line with what Plex is expecting.
chad@localhost:~$ ./rename_season.sh
mv ./Series 1/Season 1 ./Series 1/Season 01
mv ./Series 1/Season 2 ./Series 1/Season 02
mv ./Series 1/Season 3 ./Series 1/Season 03
mv ./Series 2/Season 1 ./Series 2/Season 01
mv ./Series 3/Season 1 ./Series 3/Season 01
mv ./Series 3/Season 2 ./Series 3/Season 02
mv ./Series 3/Season 3 ./Series 3/Season 03
mv ./Series 3/Season 4 ./Series 3/Season 04
mv ./Series 3/Season 5 ./Series 3/Season 05
@chadmayfield
chadmayfield / tmux-cheatsheet.markdown
Created February 11, 2019 05:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@chadmayfield
chadmayfield / indent_flags.sh
Created January 8, 2018 05:28
Using printf for fun with formatting
#!/bin/bash
flags=$(grep '^flags' /proc/cpuinfo | uniq | awk -F ": " '{print $2}')
printf "%-20s %s" "Flags:"
echo "$flags" | fold -s -w 40 | sed -e "2,\$s/^/$(echo $'\t' | pr -Te21)/"
@chadmayfield
chadmayfield / hashcat_macos.sh
Created June 2, 2017 17:24
Install Hashcat on macOS
#!/bin/bash
git clone https://github.com/hashcat/hashcat.git
mkdir -p hashcat/deps
git clone https://github.com/KhronosGroup/OpenCL-Headers.git hashcat/deps/OpenCL
cd hashcat/ && make
./hashcat --version
./hashcat -b -D 1,2
./example0.sh
@chadmayfield
chadmayfield / gist:f16a3bf27c5f2587be1ec5bb82433dd6
Created May 6, 2017 02:24
Using perl File::Fetch to download alexa top 1m, error
GET /alexa-static/top-1m.csv.zip HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Authorization: Basic YW5vbnltb3VzOkZpbGUtRmV0Y2hAZXhhbXBsZS5jb20=
From: [email protected]
Host: s3.amazonaws.com
If-Modified-Since: Fri, 05 May 2017 17:42:18 GMT
User-Agent: File::Fetch/0.38
HTTP/1.1 400 Bad Request
@chadmayfield
chadmayfield / rhel2centos.txt
Last active July 4, 2022 11:00
RHEL7 to CentOS7 conversion output
(0) [chad@macbookpro:~] $ ssh -l root 192.168.1.56
[email protected]'s password:
Last login: Thu Apr 20 11:30:29 2017
[root@localhost ~]# ./convert_rhel2centos.sh
Removing with RPM: redhat-release-server
Removing with yum: redhat-support-lib-python
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
#!/bin/bash
# get http status code using curl
curl -Iso /dev/null -w '%{http_code}\n' http://kyln.io/keybase.txt
Oct 24 13:10:56.111039 2016] [core:notice] [pid 13] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Oct 24 13:59:21.008651 2016] [core:notice] [pid 18] SELinux policy enabled; httpd running as context system_u:system_r:svirt_lxc_net_t:s0:c664,c840
[Mon Oct 24 13:59:21.009400 2016] [suexec:notice] [pid 18] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Oct 24 13:59:21.043636 2016] [ssl:notice] [pid 18] AH01884: Operating in SSL FIPS mode
[Mon Oct 24 13:59:21.044086 2016] [ssl:warn] [pid 18] AH01902: Host 10.10.10.7:443: X.509 CRL storage locations configured, but CRL checking (SSLCARevocationCheck) is not enabled
user@localhost:~$ ./fun_with_curl.sh
content_type text/html;charset=utf-8
filename_effective /dev/null
ftp_entry_path
http_code 200
http_connect 000
local_ip 192.168.15.38
local_port 50257
num_connects 1
num_redirects 0
Dump headers
curl -I https://google.com
Dump headers with content
curl -i https://google.com
Dump headers to a file
curl -sD headers2.txt -o /dev/null https://kyln.io
Be verbose in query