Skip to content

Instantly share code, notes, and snippets.

View komuw's full-sized avatar

Komu Wairagu komuw

View GitHub Profile
@komuw
komuw / sshd_config
Created June 18, 2017 16:36
sshd_config
# created using both https://wiki.mozilla.org/Security/Guidelines/OpenSSH and https://stribika.github.io/2015/01/04/secure-secure-shell.html
Protocol 2
# Supported HostKey algorithms by order of preference.
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
@komuw
komuw / ethereum_vs_bitcoin.md
Last active May 22, 2017 10:44
ethereum blockchain vs bitcoin blockchain

Bitcoin's blockchain stores financial transactions.
Ethereum's block chain stores smart contracts.
A smart contract can store records on who owns what, it can store a promise to pay & promise to deliver.
It can also automatically move funds in accordance with instructions given long in the past.

You can check the blockchain to find if the house has been sold twice, who owns this land, what happens if the loan defaults etc

@komuw
komuw / rabbit_pash_hash.py
Created May 2, 2017 00:51 — forked from lukebakken/rabbit_pash_hash.py
rabbitMQ password hashing algo
# rabbitMQ password hashing algo as laid out in: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-May/012765.html
from __future__ import print_function
import base64
import os
import hashlib
import struct
# This is the password we wish to encode
password = 'simon'
@komuw
komuw / generate_rmq_pass_hash.sh
Created April 28, 2017 15:28
generate rabbitmq password has.
#!/usr/bin/env bash
# copied from https://gist.github.com/lukebakken/7b4da46ed9abb7ed14f7a60b49f9e52e
# discussion from here: https://groups.google.com/forum/#!topic/rabbitmq-users/Brx3tSmNC_8
set -o errexit
set -o nounset
declare -r passwd="${1:-newpassword}"
@komuw
komuw / rabbit_pash_hash.py
Last active April 28, 2017 18:40
rabbitMQ password hashing algo
# rabbitMQ password hashing algo as laid out in: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-May/012765.html
#1.Generate a random 32 bit salt:
import os
salt = os.urandom(32)
salt = ''.join(x.encode('hex') for x in salt)
salt = salt.upper()
#2.Concatenate that with the UTF-8 representation of the password (in this case "simon")
simon = ''.join(x.encode('hex') for x in 'simon')
@komuw
komuw / paypal_express.js
Last active December 24, 2019 05:17
create paypal express checkout app
// create a paypal express checkout app
1. create a sandbox paypal app: https://developer.paypal.com/developer/applications (under REST API apps)
2. copy the app email([email protected]), client_id(Ac3vNqODzxe40U2kczQd92e4CGDor1SVM7GBfHzimCflhTaS6CtHW-jHMwys1RAKFzfLM-vX7xFPfCzo
)
3. use the client_id from above and replace it in the html_snippet below
4. configure webhooks for any events that occur: https://developer.paypal.com/docs/integration/direct/webhooks/rest-webhooks/
example of events that can occur-> https://developer.paypal.com/docs/integration/direct/webhooks/event-names/
5. setup a Return URL - Target URL where users will be redirected after test transactions. Please allow up to 3 hours for the change to go into effect.
6. You will go through the same steps later on when you want to create the proper LIVE prod paypal. app
@komuw
komuw / pritunl_client.confs
Last active February 14, 2017 13:00
configure pritunl vpn client
$ cat /etc/apt/sources.list.d/pritunl.list
deb https://repo.pritunl.com/stable/apt xenial main
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
sudo apt-get update
sudo apt-get install pritunl-client-gtk
# download profile(vpn config)
# start pritunl client from apps
@komuw
komuw / openvpn_client.confs
Last active December 14, 2016 13:51
client config for openvpn
$ sudo apt -y install openvpn
## cat /etc/openvpn/client.conf
remote <PUBLI_IP> 1194
proto udp
ns-cert-type server
client
dev tun
resolv-retry infinite
@komuw
komuw / delete_old_git_branches.sh
Last active September 1, 2016 17:06
delete branches that are older than x days
# delete branches that are older than x days
# this will delete branches that havent received any commits that are newer than Aug 10, 2016
# see this answer for a bit more detail: http://stackoverflow.com/questions/10325599/delete-all-branches-that-are-more-than-x-days-weeks-old/39277210#39277210
for k in $(git branch -r | sed /\*/d); do
if [ -z "$(git log -1 --since='Aug 10, 2016' -s $k)" ]; then
branchnew=$(echo $k | sed -e "s/origin\///")
echo deleting branch: $branchnew
git push origin --delete $branchnew
fi