Skip to content

Instantly share code, notes, and snippets.

View komuw's full-sized avatar

Komu Wairagu komuw

View GitHub Profile
@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 / 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
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 / 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 / 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 / grub
Created July 26, 2017 09:12
edit grub, debug boot errors, hibernate errors etc
1. cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
@komuw
komuw / extractnums.py
Created August 28, 2017 12:52
extract numbers from string
str = "h3110 23 cat 444.4 rabbit 11 2 dog"
numbers = [int(s) for s in str.split() if s.isdigit()]
sum_of_numbers = sum(numbers)
print "sum_of_numbers:", sum_of_numbers
@komuw
komuw / gctest.go
Last active January 25, 2018 14:26
measure GC for different maps
package main
import (
"strconv"
"fmt"
"os"
"runtime"
"time"
)
// run this program as:
/*
@komuw
komuw / 01_flutter.md
Last active September 2, 2019 13:06
flutter notes

flutter