Skip to content

Instantly share code, notes, and snippets.

(1/7) Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]?

Keybase proof

I hereby claim:

  • I am rgarth on github.
  • I am rgarth (https://keybase.io/rgarth) on keybase.
  • I have a public key ASCY7kfV6JHAgKaUkhUTILTq0riZ3ocmosXlasXhxJfuLgo

To claim this, I am signing this object:

#!/bin/bash
for pid in [0-9]*; do
echo "PID = $pid with $(ls /proc/$pid/fd/ | wc -l) file descriptors"
done | sort -rn -k5 | head | while read -r _ _ pid _ fdcount _; do
command=$(ps -o cmd -p "$pid" -hc)
printf "pid = %5d with %4d fds: %s\n" "$pid" "$fdcount" "$command"
done
@rgarth
rgarth / gist:ae388b57ef880df23847bb2fde327355
Created June 13, 2018 08:50
List ip address connect ordered by largest number of connections
netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
@rgarth
rgarth / gist:f120eb04cd6ea1adb8c21be491762f81
Created June 5, 2018 04:51
Add Clippy to your website
<!-- Clippy.css -->
<link rel="stylesheet" href="https://cdn.rawgit.com/smore-inc/clippy.js/master/src/clippy.css">
<!-- jQuery 1.7+ -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- Clippy.js -->
<script src="https://cdn.rawgit.com/smore-inc/clippy.js/master/build/clippy.min.js"></script>
<!-- Clippy Init script -->
<script type="text/javascript">
clippy.load('Clippy', function(agent){
// do anything with the loaded agent
@rgarth
rgarth / yubikey-reset.sh
Last active December 3, 2017 20:57 — forked from pkirkovsky/yubikey-reset.sh
Utility for resetting a Yubikey to factory defaults using gpg-connect-agent. This will wipe out any stored keys and reset PINs to default values.
gpg-connect-agent <<EOF
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
@rgarth
rgarth / gist:0d14871e245afd7369d4fa3c8bf74afc
Created November 30, 2017 00:04
openssl command, remote cert validity check
$ echo | penssl s_client -servername www.example.com -connect www.example.com:443 2>/dev/null | openssl x509 -text
@rgarth
rgarth / keybase.md
Last active September 10, 2019 00:12

rgarth Rob Garth Springwood, NSW, Australia

Keybase proof

I hereby claim:

  • I am rgarth on github.
  • I am rgarth (https://keybase.io/rgarth) on keybase.
  • I have a public key ASCY7kfV6JHAgKaUkhUTILTq0riZ3ocmosXlasXhxJfuLgo