Skip to content

Instantly share code, notes, and snippets.

View chadmayfield's full-sized avatar

Chad Mayfield chadmayfield

View GitHub Profile
### Keybase proof
I hereby claim:
* I am chadmayfield on github.
* I am crm (https://keybase.io/crm) on keybase.
* I have a public key whose fingerprint is A22C 343E 104B B7A4 A257 30B3 E854 9105 B0B8 DBFB
To claim this, I am signing this object:
@chadmayfield
chadmayfield / print_env.py
Created June 14, 2016 03:28
Print env in python
#!/usr/bin/python
import os
for param in os.environ.keys():
print "%20s %s" % (param,os.environ[param])
#!/bin/bash
find / -path /proc -prune -o -path /dev -prune -o -type f -size +50M -exec ls -lh {} \; | awk '{ print $5 "\t: " $NF}' | sort --human-numeric-sort -r
@chadmayfield
chadmayfield / view_conns.sh
Last active June 16, 2016 19:15
View established connections with hostnames
#!/bin/bash
netstat -tunlap | awk '{print $5}' | grep [0-9] | egrep -v '(127|0).0.0.*|::1'| awk -F ':' '{print $1}' | sort -u | xargs -n 1 host
Phone shortcuts
------------------------
1. *#06# – IMEI number
2. *#0*# – Service menu on devices like the Galaxy S III
3. *#*#4636#*#* – Information about device, user statistics and battery
4. *#*#34971539#*#* – Details on camera
5. *#*#273282*255*663282*#*#* –Instant backup media files
6. *#*#197328640#*#* – Activating test mode devices
7. *#*#232339#*#* – Test for Wireless LAN
8. *#*#0842#*#* – Test for vibration and backlight
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
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
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
#!/bin/bash
# get http status code using curl
curl -Iso /dev/null -w '%{http_code}\n' http://kyln.io/keybase.txt
@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
root@192.168.1.56'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