I hereby claim:
- I am exenon on github.
- I am xaviernunn (https://keybase.io/xaviernunn) on keybase.
- I have a public key ASA7BlDwxvlOvRN20Imtbx1vs_-I1QYryBHXeBqDzKgJ7go
To claim this, I am signing this object:
#!/usr/bin/python2 | |
""" | |
Use scapy to modify packets going through your machine. | |
Based on nfqueue to block packets in the kernel and pass them to scapy for validation | |
""" | |
import nfqueue | |
from scapy.all import * | |
import os |
# Constants - taken from dpkt/ssl.py | |
import struct | |
# SSLv3/TLS versions | |
SSL3_V = 0x0300 | |
TLS1_V = 0x0301 | |
TLS11_V = 0x0302 | |
TLS12_V = 0x0303 |
def make_id(mongo_id: ObjectId, date=None, iteration=0): | |
target_date = date or mongo_id.generation_time.replace(tzinfo=None) | |
hasher = hashlib.sha1() | |
hasher.update(mongo_id.binary) | |
hasher.update(str(iteration).encode()) | |
hash = hasher.digest() | |
time = int((target_date - datetime(1582, 10, 15)).total_seconds() * 10000000) | |
time_low = time & 0xffffffff | |
time_mid = (time >> 32) & 0xffff |
I hereby claim:
To claim this, I am signing this object:
""" | |
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" |
module Main exposing (..) | |
import Html exposing (Html, button, div, text, ul, li, input) | |
import Html.Events exposing (onClick, onInput) | |
import Html.Attributes exposing (placeholder, value) | |
import List exposing (map, length) | |
main = | |
Html.beginnerProgram { model = model, view = view, update = update } |
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 |
# 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 |
#!/bin/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="Your Correct Name" | |
CORRECT_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" |
# 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" |