Skip to content

Instantly share code, notes, and snippets.

View peterkuiper's full-sized avatar

Peter Kuiper peterkuiper

  • The Netherlands
View GitHub Profile
@peterkuiper
peterkuiper / boto3_hands_on.md
Created January 25, 2019 17:15 — forked from iMilnb/boto3_hands_on.md
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@peterkuiper
peterkuiper / revoke_user.sh
Created October 6, 2017 08:45 — forked from rynop/revoke_user.sh
revoke client cert
#!/bin/bash
function usage () {
echo "$0 [CA section name] [username]"
exit 1
}
if [ $# -ne 2 ]
then
usage
@peterkuiper
peterkuiper / gist:0ecde59130795e426d0472db564dc625
Created October 6, 2017 08:12 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@peterkuiper
peterkuiper / pre-commit
Last active July 5, 2017 14:34
Git pre-commit hook that runs ESLint
#!/bin/bash
TOPLEVEL=$(git rev-parse --show-toplevel)
ESLINT_CMD="${TOPLEVEL}/node_modules/.bin/eslint"
if [[ ! -x "$ESLINT_CMD" ]]; then
echo "\t\033[41mPlease install ESlint\033[0m (npm i --save --save-exact --dev eslint)"
exit 1
fi
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@peterkuiper
peterkuiper / README.md
Last active January 28, 2018 06:16
Apps
# Delete all object versions from a bucket:
aws --output text s3api list-object-versions --bucket <your bucket> | grep -E "^VERSIONS" | awk '{print "aws s3api delete-object --bucket <your bucket> --key "$4" --version-id "$8";"}'
# Delete all deletion markers from a bucket:
aws --output text s3api list-object-versions --bucket <your bucket> | grep -E "^DELETEMARKERS" | awk '{print "aws s3api delete-object --bucket <your bucket> --key "$3" --version-id "$5";"}'
# Bucket size
@peterkuiper
peterkuiper / gist:d4657a3c8c9b37a46656
Last active April 22, 2022 09:36
Permanently Disable Notification Center (thank you)
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall SystemUIServer

Remove NodeJS installed from pkg:

lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
  sudo rm /usr/local/${i}
done
sudo rm -rf /usr/local/lib/node \
     /usr/local/lib/node_modules \
 /var/db/receipts/org.nodejs.*