Skip to content

Instantly share code, notes, and snippets.

@0x0all
0x0all / AdvancedDistributedSystemDesignCourseNotes.md
Created October 3, 2022 21:44 — forked from craigtp/AdvancedDistributedSystemDesignCourseNotes.md
Notes on Udi Dahan's Advanced Distributed System Design Course

Advanced Distributed System Design Course - Udi Dahan

Notes by Craig Phillips

Fallacies of Distributed Computing

  • There are 11 fallacies of Distributed Computing:
    1. The network is reliable
    2. Latency isn’t a problem
    3. Bandwidth isn’t a problem
    4. The network is secure
  1. The topology won’t change
@0x0all
0x0all / GO-Fillslice.md
Created May 2, 2022 17:03 — forked from taylorza/GO-Fillslice.md
Golang - Fill slice/array with a pattern

Filling an array or slice with a repeated pattern

Looking for an efficient pure GO approach to copy repeating patterns into a slice, for a toy project, I ran a few tests and discovered a neat approach to significantly improve performance. For the toy project, I am using this to fill a background buffer with a specific RGB color pattern, so improving this performance significantly improved my acheivable framerate.

All the test were run with a buffer of 73437 bytes, allocated as follows

var bigSlice = make([]byte, 73437, 73437)

Fill the slice with the value 65 by looping through each element and setting the value

@0x0all
0x0all / chain.py
Created April 9, 2022 12:27
chain.py
for num in chain(range(12_300, 40_944),
range(44_000, 64_207)):
@0x0all
0x0all / string.py
Last active April 9, 2022 10:49
string.py
import string
info = [eval(f"('{a}', string.{a})") for a in dir(string) if not a.startswith("_")]
for elem in info:
print(elem)
@0x0all
0x0all / shuffle.py
Last active January 31, 2022 14:37
shuffle
# https://stackoverflow.com/questions/57340713/how-do-i-un-shuffle-a-list-back-to-its-original-form
import random
def getperm(l):
random.seed(101)
perm = list(range(len(l)))
random.shuffle(perm)
return perm
@0x0all
0x0all / sh
Created December 1, 2021 16:30
install snap in linux mint 20.04
sudo rm /etc/apt/preferences.d/nosnap.pref
sudo apt update
sudo apt install snapd
@0x0all
0x0all / main.go
Created July 19, 2021 21:51 — forked from yingray/main.go
Golang: aes-256-cbc examples (with iv, blockSize)
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"fmt"
)
import cv2
cap = cv2.VideoCapture(0)
# Capture frame
ret, frame = cap.read()
if ret:
cv2.imwrite('image.jpg', frame)
cap.release()
#include <memory>
#include <iostream>
class objectA {
public:
~objectA() {
std::cout << "A";
}
};
@0x0all
0x0all / sql
Created June 10, 2021 11:06
MySQL isolation
set session transaction isolation level read comitted; - сразу данные видны в текущей сессии из другой сессии
start transaction;
...
commit;
set session transaction isolation level repeatable read; - данные не видны в текущей сессии из другой сессии