Skip to content

Instantly share code, notes, and snippets.

View AmirSoleimani's full-sized avatar
🧑‍💻

Amir So AmirSoleimani

🧑‍💻
View GitHub Profile
@AmirSoleimani
AmirSoleimani / README.md
Last active December 12, 2018 12:36
Redis Pub/Sub

Redis Publish/Subscribe Sample

Car: Subscriber

Food: Publisher

@AmirSoleimani
AmirSoleimani / Singleton.go
Created November 19, 2018 17:19
Singleton Pattern - Golang (Simple)
package singleton
import (
"fmt"
"sync"
)
//singleton variables
type singleton map[string]interface{}
@AmirSoleimani
AmirSoleimani / main.go
Last active January 10, 2023 08:18
Pub/Sub Pattern Golang
package main
import (
"patternsample/mq"
"fmt"
"time"
)
func main() {
#!/bin/bash
scrot 'ss.png' -e 'mv $f ~/Pictures'
convert ~/Pictures/ss.png -blur 0x5 ~/Pictures/sss.png
i3lock -f -i ~/Pictures/sss.png
@nikhita
nikhita / update-golang.md
Last active September 20, 2024 13:10
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
set $mod Mod4
#consts
set $w1 1:
set $w2 2:
separator_block_width=15
color=#CCCCCC
align=center
[online-status]
command=echo "ping $(ping -c 1 8.8.8.8 | awk '/from/ {print $7}' | cut -d'=' -f 2)ms"
#||echo ''
#command=ping googe.com || echo asd
#color=#FF0000
interval=40
alias asd="git pull upstream master --rebase"
alias sa="sudo apt-get install"
export GOPATH=~/gopath
export PATH=$PATH:/usr/local/go/bin
export GOBIN=/usr/local/go/bin
@pkuczynski
pkuczynski / parse_yaml.sh
Last active September 13, 2024 07:56
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
# Raw transaction API example work-through
# Send coins to a 2-of-3 multisig, then spend them.
#
# For this example, I'm using these three keypairs (public/private)
# 0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU
# 04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk
# 048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw
# First: combine the three keys into a multisig address:
./bitcoind createmultisig 2 '["0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86","04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a9