Skip to content

Instantly share code, notes, and snippets.

@shoan
shoan / setup.sh
Created January 13, 2025 11:27 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
### Keybase proof
I hereby claim:
* I am shoan on github.
* I am shoan (https://keybase.io/shoan) on keybase.
* I have a public key ASDf6q4UxMLX5osaQuv3SNHxZBKgo2wvQ2F_YHBgYKqXrwo
To claim this, I am signing this object:
@shoan
shoan / gpg-ssh-setup.md
Created May 17, 2022 04:40 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@shoan
shoan / sql.sql
Created November 3, 2021 17:32
create_a_time_dimension
-- From https://www.etl-tools.com/articles/time-dimension-for-posgresql-based-data-warehouse.html
CREATE TABLE d_time
(
time_key integer NOT NULL,
time_value character(5) NOT NULL,
hours_24 character(2) NOT NULL,
hours_12 character(2) NOT NULL,
hour_minutes character (2) NOT NULL,
day_minutes integer NOT NULL,
day_time_name character varying (20) NOT NULL,
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@shoan
shoan / postgres_queries_and_commands.sql
Last active February 12, 2023 14:08 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- Queries running longer than 2 mins
SELECT pid, now() - query_start as "runtime", usename, datname, state, now() - state_change as "state_changed_age", wait_event_type, wait_event, query
FROM pg_stat_activity
WHERE now() - query_start > '2 minutes'::interval and state = 'active'
ORDER BY runtime DESC;
-- Query to kill queries
SELECT pg_cancel_backend(pid)
FROM pg_stat_activity
WHERE now() - query_start > '2 minutes'::interval and state = 'active'
@shoan
shoan / gist:833c7467d37ba4b99795be3ad827129f
Last active June 1, 2020 11:13
Check if an ssl certificate and key match
openssl rsa -modulus -noout -in myserver.key | openssl md5
openssl rsa -check -noout -in myserver.key
# RSA Key is ok
# If it doesn't say 'RSA key ok', it isn't OK!"
# To view the modulus of the RSA public key in a certificate:
openssl x509 -modulus -noout -in myserver.crt | openssl md5
# To view the hash of the CSR
@shoan
shoan / Pipfile
Last active April 30, 2020 08:00 — forked from skwashd/README.md
Copy AWS SSM Parameter Store Path
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
boto3 = "*"
@shoan
shoan / bash_aws_jq_cheatsheet.sh
Created September 21, 2019 04:54 — forked from lukeplausin/bash_aws_jq_cheatsheet.sh
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@shoan
shoan / README.md
Created June 27, 2017 01:32 — forked from jehaby/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \