Skip to content

Instantly share code, notes, and snippets.

@AmirSoleimani
AmirSoleimani / wsdb.sh
Created July 9, 2021 07:52
World's simplest database
#!/bin/bash
db_set() {
echo "$1, $2" >> database.st
}
db_get () {
grep "^$1," database.st | sed -e "s/^$1,//" | tail -n 1
}
@AmirSoleimani
AmirSoleimani / proxy_request.go
Last active July 3, 2021 23:22
NordVPN Proxy and HTTP Request
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"time"
@AmirSoleimani
AmirSoleimani / README.md
Last active December 12, 2018 12:36
Redis Pub/Sub

Redis Publish/Subscribe Sample

Car: Subscriber

Food: Publisher

@AmirSoleimani
AmirSoleimani / gcd.go
Created November 21, 2018 09:46
GCD - Greatest Common Divisor
package cryptogcd
//GCD Greatest Common Divisor (Factor)
func GCD(a, b int) int {
var Remainder int
for {
Remainder = a % b
a = b
b = Remainder
if b == 0 {
@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() {