Skip to content

Instantly share code, notes, and snippets.

View eXenon's full-sized avatar

Xavier NUNN eXenon

View GitHub Profile
@eXenon
eXenon / Server.py
Created February 17, 2021 07:04 — forked from HaiyangXu/Server.py
A simper python http server can handle mime type properly
# -*- coding: utf-8 -*-
#test on python 3.4 ,python of lower version has different module organization.
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
@eXenon
eXenon / gen-ssl.sh
Created November 24, 2020 15:58 — forked from thbkrkr/gen-ssl.sh
Generate Self-Signed SSL Certificate without prompt
# Generate a passphrase
openssl rand -base64 48 > passphrase.txt
# Generate a Private Key
openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048
# Generate a CSR (Certificate Signing Request)
openssl req -new -passin file:passphrase.txt -key server.key -out server.csr \
-subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io"
@eXenon
eXenon / udp_server.exs
Created February 24, 2019 15:43 — forked from joshnuss/udp_server.exs
Fault tolerant UDP Server in Elixir
# to run:
# > elixir --no-halt udp_server.exs
# to test:
# > echo "hello world" | nc -u -w0 localhost:2052
# > echo "quit" | nc -u -w0 localhost:2052
# Let's call our module "UDPServer"
defmodule UDPServer do
# Our module is going to use the DSL (Domain Specific Language) for Gen(eric) Servers
use GenServer
@eXenon
eXenon / latency.txt
Created June 7, 2018 15:27 — 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
@eXenon
eXenon / clip_magic.py
Last active March 4, 2021 07:16 — forked from asfaltboy/clip_magic.py
Python3 compatible copy-to-clipboard magic for IPython
"""
Add copy to clipboard from IPython!
To install, just copy it to your profile/startup directory, typically:
~/.ipython/profile_default/startup/
Example usage:
%clip hello world
# will store "hello world"