Skip to content

Instantly share code, notes, and snippets.

View imladenovic's full-sized avatar

Ivan Mladenović imladenovic

View GitHub Profile
@imladenovic
imladenovic / generateselfsigned.md
Created October 1, 2022 12:13 — forked from magnetikonline/README.md
Generating a self signed SSL certificate.

Generating a self signed SSL certificate

Creates a resulting server.crt certificate and server.key private key.

Method one

  • $ openssl genrsa -des3 -out server.key.tmp 1024
    • Note: Enter a dummy pass pharse (e.g. 1234) and remember it
  • $ openssl rsa -in server.key.tmp -out server.key
    • Enter dummy pass pharse from previous step
  • Generate certificate request file (CSR)
  • $ openssl req -new -key server.key -out server.csr
@imladenovic
imladenovic / README.md
Created October 1, 2022 12:07 — forked from magnetikonline/README.md
Python threaded workers using ThreadPoolExecutor().

Python threaded workers using ThreadPoolExecutor()

A pattern for using concurrent.futures.ThreadPoolExecutor() to execute a series of "worker" functions in parallel, processing a queue of assigned "work".

How it works:

  • worker_init() creates:
    • Queues for "work" and "results".
    • A threading.Event() to denote "no more work in queue".
    • A futures.ThreadPoolExecutor().
@imladenovic
imladenovic / System Design.md
Created April 30, 2019 16:12 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
func within(d time.Duration, f func() bool) bool {
deadline := http://time.Now ().Add(d)
for http://time.Now ().Before(deadline) {
if f() { // 🔥
return true
}
}
return false
}
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@imladenovic
imladenovic / main.go
Last active December 27, 2015 22:58
how to stop gorutine using quit channel
/**
How to stop long running goroutine
*/
package main
import "fmt"
import "time"
func main() {
done := make(chan bool)
namespace Orders
{
public class Company
{
public string Id { get; set; }
public string ExternalId { get; set; }
public string Name { get; set; }
public Contact Contact { get; set; }
public Address Address { get; set; }
public string Phone { get; set; }