Skip to content

Instantly share code, notes, and snippets.

View xiongchiamiov's full-sized avatar

James Pearson Hughes xiongchiamiov

View GitHub Profile
#!/usr/bin/env python3
import csv
import sys
from collections import Counter
counter = Counter()
with open(sys.argv[1]) as csvfile:
reader = csv.DictReader(csvfile)
function wchs {
for i in "$@"; do
count=$(find "$i" | wc -l)
echo "$count\t$i"
done
}
function wchs-sort {
wchs "$@" | sort -nr
}
@xiongchiamiov
xiongchiamiov / why.sh
Last active March 14, 2023 04:19
Use this when Amazon gives you an "Encoded authorization failure message" and you need to turn it into something readable. If you only get a request id... you're out of luck.
function decode-authorization-failure-message {
if [ $# -ne 1 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
cat <<'EOT'
Usage: decode-authorization-failure-message <message>
Use this when Amazon gives you an "Encoded authorization failure message" and
you need to turn it into something readable.
EOT
return 1
fi
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
└─[$]>cat function.sh
function install {
set -x
dnf install $1 | tee -a ~/Scripts/dnf_install.log
set +x
}
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
└─[$]>source function.sh
┌─[jamesph@ilmr] - [~/temp] - [Wed Apr 06, 11:12]
[$]> ansible all -i hosts.ini --ask-sudo-pass -m apt -a 'update_cache=yes upgrade=safe' --become
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ll
total 0
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> touch foo
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ln -s foo bar
┌─[jamesph@ilmr] - [~/temp/rm_if_link] - [Wed Mar 23, 01:14]
└─[$]> ll
total 0
@xiongchiamiov
xiongchiamiov / docker.md
Last active March 3, 2016 20:57
Dealing with docker's disk space issues

See how much space is available

[$]> docker info 2>/dev/null | grep 'Data Space'     
 Data Space Used: 107.4 GB                             
 Data Space Total: 107.4 GB                            
 Data Space Available: 20.05 MB                        

Delete old containers

[$]> docker ps -aq | xargs docker rm

Improving Security for Bugzilla

Frequently asked questions

What happened?

Bugzilla restricts access to security-sensitive information so that only certain privileged users can access it. An attacker was able to break into a privileged user’s account and download security-sensitive information about flaws in Firefox and other Mozilla products.

How did the attacker gain access?

Process: clementine [19189]
Path: /Applications/clementine.app/Contents/MacOS/clementine
Identifier: org.clementine-player.clementine
Version: 1.2.3-1280-g10860b7 (4096.1.2.3.2.1280)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: clementine [19189]
User ID: 501
Date/Time: 2015-08-04 13:24:02.003 -0700
#!/usr/bin/env python
import requests
from constants import *
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
data = {
'grant_type': 'password',
'username': username,