Skip to content

Instantly share code, notes, and snippets.

View ttuanho's full-sized avatar
🎯
Focusing

Tuan Ho ttuanho

🎯
Focusing
View GitHub Profile
@marirs
marirs / rust-cross-compile-diesel-postgresql
Last active December 9, 2022 05:11
Rust Cross Compile Diesel-PostgreSQL for Linux on Mac M1
# Download the Source
```bash
cd /tmp/
wget https://ftp.postgresql.org/pub/source/v14.2/postgresql-14.2.tar.gz
tar xvf postgresql-14.2.tar.gz
cd postgresql-14.2
```
# Configure
# - with openssl
@michalc
michalc / decrypt-ses-emails-in-s3.py
Last active November 16, 2022 03:49
Decrypt KMS-encrypted SES emails in an S3 bucket
import base64
import json
import boto3
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
s3 = boto3.resource('s3')
bucket = s3.Bucket('my-bucket')
kms_client = boto3.client('kms')
@4gus71n
4gus71n / get_all_streets_from_oms.py
Created April 4, 2020 20:52
Short script to get all the street names in one city
# pip install requests
# pip install bs4
# pip install overpass
# pip install html5lib
from pprint import pprint
import overpass
import urllib.parse
import requests
from bs4 import BeautifulSoup
@JamesChevalier
JamesChevalier / overpass_query_all_streets.md
Last active March 20, 2024 13:33
Overpass API query to retrieve all streets in a city

An area ID in Overpass is the OSM relation ID + 3600000000

This information is kind of buried in the Overpass API wiki page documenting the available filters: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29

The OSM relation ID can be seen in two places:

  • Visit https://www.openstreetmap.org and search for the city
  • Click on its entry and you will be taken to a https://www.openstreetmap.org/relation/SOME_NUMBER_HERE page
  • The relation ID is in the URL as "SOME_NUMBER_HERE" in the bullet point above
  • The relation ID will also be in parentheses next to the city name in the left column
@gmolveau
gmolveau / install_dirb.sh
Created September 2, 2019 12:01
mac osx dirb install
cd ~/Applications
wget https://downloads.sourceforge.net/project/dirb/dirb/2.22/dirb222.tar.gz
tar -xvf dirb222.tar.gz
rm dirb222.tar.gz
brew install autoconf
chmod -R 755 dirb222
cd dirb222
./configure
make
make install
@EddiG
EddiG / wireshark.md
Last active March 31, 2024 10:34
How to decrypt SSL/TLS traffic in Wireshark on MacOS

The main point is to save the SSL/TLS keys those used by the web browser (SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log).
In the example below we run brand new instance of Google Chrome (--user-data-dir=/tmp/tmp-google do the trick):
SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/tmp-google
Then run the Wireshark and open the Preferences -> Protocols -> SSL, where we put the path to the SSL keys log file into the (Pre)-Master-Secret log filename field.
Now all SSL/TLS traffic from this browser instance will be decrypted.

@krisleech
krisleech / renew-gpgkey.md
Last active May 20, 2024 08:24
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@veuncent
veuncent / aws_glacier_delete_vault.md
Last active May 12, 2024 18:26
Delete all archives in an AWS Vault

AWS Glacier: Delete vault

Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.

Step 1 / Retrieve inventory

This will create a job that collects required information about the vault.

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME 
@exAspArk
exAspArk / self-signed-ssl-mongo.sh
Last active April 6, 2024 19:38
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
@visualdensity
visualdensity / princeton_algo_setup.sh
Last active March 2, 2022 08:17
Java setup for Princeton Algorithm Course on Coursera (https://www.coursera.org/learn/algorithms-part1). Ran this on Ubuntu 16.04.
#!/bin/bash
# Sets your JAVA environment for course based on this:
# http://algs4.cs.princeton.edu/linux/
algs_path=/usr/local/algs4
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java8-installer