Skip to content

Instantly share code, notes, and snippets.

@lox
lox / aws-keychain-sts.sh
Created August 5, 2015 06:26
A wrapper for @pda's aws-keychain that generates temporary credentials via STS.
#!/bin/bash
set -euo pipefail
: ${AWS_CREDENTIALS_FILE="$HOME/.aws/credentials"}
: ${STS_SESSION_DURATION=36000}
sts_keychain_get_session_token() {
echo generating temporary credentials via sts >&2
aws-keychain exec $1 \
@luchoching
luchoching / .aliases
Last active May 22, 2020 18:38
aliases
alias c="clear"
alias so="source ~/.zshrc"
alias rm='rm -i'
alias rmr='rm -rf'
alias srmr='sudo rm -rf'
alias df='df -h'
alias wget='wget -c' #Continue getting a partially-downloaded file
alias mkdir='mkdir -pv'
alias date='date +"%Z %Y-%m-%d %A %T"'
alias cd..='cd ..'
@pandeybk
pandeybk / find_iam_users_and_groups.py
Last active August 9, 2021 19:40
Find all IAM Users and assigned groups boto3
import boto3
iam = boto3.client('iam')
def find_user_and_groups():
for userlist in iam.list_users()['Users']:
userGroups = iam.list_groups_for_user(UserName=userlist['UserName'])
print("Username: " + userlist['UserName'])
print("Assigned groups: ")
for groupName in userGroups['Groups']:
@leereilly
leereilly / law-breakin-apis.md
Created January 19, 2016 07:58
Law Breakin' APIs

via https://twitter.com/romzr/status/689309894034456577:

what sort of APIs would be most useful? Player/matches stats, other stuff?

Basic API endpoints for players, weapons, factions, characters, and leaderboards would be a great starting point - useful for building out fun dashboards, profiles, dynamic images, etc. Endpoints for matches, maps, gamemodes, etc. getting into the real gameplay data would be useful for more challenging neckbeardy stuff. I noted a few example endpoints and use cases below.

Any example of game APIs u like?

I don't have any examples for games APIs that I play && like && use, but Riot Games' API and Battle.net Community APIs (WoW, Starcraft, Diablo) look great and are well-documented. If it doesn't have great documentation, it's not a great API IMHO.

@jjnilton
jjnilton / mac-network-commands-cheat-sheet.md
Last active October 20, 2025 23:48
Mac Network Commands Cheat Sheet

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

The original author seems to be Charles Edge, here's the original content, as pointed out by @percisely.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and s

@gustavo-rodrigues-dev
gustavo-rodrigues-dev / alias.sh
Created March 28, 2016 12:57
pbcopy for ubuntu
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
@kidager
kidager / .zshrc
Last active January 16, 2023 17:03
ZSH Powerline installation
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
#!/usr/bin/env python
from __future__ import print_function
import boto3
import json
import random
# A list of Role, User, and account ARNs to allow
# assumption from at random.
BACKDOOR_ROLES = [
'your-arn-here'

disclaimer, I did not post the original article , I've just repost it here as it the original article had malformed html which made it difficult to read.

Python Parsing Ep. I: Lexing Python (with ANTLR)

For a while now, I’ve been writing a code editor for Python. I know there are quite enough of these, but I wanted something a bit different. I decided to write it in C#, and I’m glad I did  –  C#’s GUI is really easy and fun to write, probably the best GUI-writing experience I’ve had since VB.

So, at some point of the project I did the horrible mistake of attempting to parse Python. Now, had I been trying

@eguven
eguven / brew-list.sh
Last active August 17, 2025 22:27
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h