Skip to content

Instantly share code, notes, and snippets.

View rsarai's full-sized avatar
🏜️

Rebeca Sarai rsarai

🏜️
View GitHub Profile
@rsarai
rsarai / latency.txt
Created June 10, 2022 00:07 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
-- psql
-- \timing on
-- Creating test data
CREATE TABLE largetable (id INT NOT NULL, content TEXT);
INSERT INTO largetable
SELECT i, 'The Road Not Taken'
'Two roads diverged in a yellow wood,'
'And sorry I could not travel both'
# Yield results asynchronously in python
# https://stackoverflow.com/questions/23351332/yield-results-asynchronously-in-python-using-multiprocessing-or-twisted
# https://medium.com/@apbetahouse45/asynchronous-web-scraping-in-python-using-concurrent-module-a5ca1b7f82e4
# https://stackoverflow.com/questions/22445054/asyncio-yield-from-concurrent-futures-future-of-an-executor
# https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.submit
import time
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
// ==UserScript==
// @name Airflow auto-reload
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Rebeca
// @match http://localhost:3000/*
// @grant none
// ==/UserScript==
import time
import random
sorted_array = []
unsorted_array = []
for i in range(0, 1000000):
random_integer = random.randint(0, 1000000)
unsorted_array.append(random_integer)
# Celery
CELERY_SEND_TASK_ERROR_EMAILS = True
CELERYD_HIJACK_ROOT_LOGGER = False
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'root': {
'level': 'INFO',
'handlers': ['console', 'sentry'],

Ryu Firewall

Topology

Commands

  • On an usual terminal
$ sudo mn --topo single,3 --mac --switch ovsk --controller remote -x
*** Creating network
// To present on class, run the following commands
sudo killall controller
sudo mn -c
// terminal
sudo mn -x --topo single,3 --mac --controller remote --switch ovsk
// switch root s1
sudo ovs-vsctl set bridge s1 protocols=OpenFlow13
@rsarai
rsarai / app.py
Last active January 19, 2019 15:16
import falcon
from .movies import Movie
api = application = falcon.API()
movie = Movie()
api.add_route('/movies', movie)