Skip to content

Instantly share code, notes, and snippets.

View raised_wall.py
import math
import numpy
from fractions import Fraction
m = [15.25, 16, 15.25, 16.75, 16, 15.25, 16.75, 16, 12.25, 3]
m_abs = []
runner = 0
for i in m:
runner += i
View schema.ebnf
Schema = SCHEMA-TYPE TLV-LENGTH
StringTable
TokenTable
StringTable = STRING-TABLE-TYPE TLV-LENGTH *OCTET
TokenTable = TOKEN-TABLE-TYPE TLV-LENGTH *Token
Token = Offset Size
@cawka
cawka / qt-creator-ndn-style.xml
Created Nov 17, 2021
QT Creator NDN style approximation
View qt-creator-ndn-style.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 4.8.84, 2021-11-17T10:54:55. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">false</value>
View gist:b556ed037f0a663b21d14dbdaced865f
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "dct-dev-1"
config.vm.box = "bento/ubuntu-20.04"
config.vm.hostname = "dct"
config.vm.provider "virtualbox" do |vb|
vb.name = "dct-dev-1"
vb.cpus = "8"
vb.memory = "16384"
View .zshrc
# setopt noautomenu
autoload -Uz compinit && compinit
autoload bashcompinit && bashcompinit
setopt autocd
bindkey "[D" backward-word
bindkey "[C" forward-word
bindkey "^[a" beginning-of-line
bindkey "^[e" end-of-line
View time_tlv.py
b = 0
m_bits = 5
m_max = (1<<m_bits)
for i in range(0,256):
e = i >> m_bits
m = i & ((1<<m_bits) - 1)
if e == 0:
x = (0 + m / m_max) * pow(2, 1 + b)
View rto-analysis.py
rto = 3000
sample=0
x = [400.0, 200.0, 200.0, 200.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
srtt = 0
for i in x:
if srtt == 0:
srtt = i
devRtt = srtt / 2.0
else:
@cawka
cawka / rtt-unfairness.py
Created Oct 17, 2019
rtt-unfairness.py
View rtt-unfairness.py
flow1 = 1.0
flow2 = 1.0
for i in range(1, 100):
flow1 = flow1 * 2
# flow 2 twice as fast
flow2 = flow2 * 2
flow2 = flow2 * 2
View graffle2pdf
#! /usr/bin/osascript
on run argv
if not (count argv) = 2
return "Usage:\n graffle2pdf <input file> <output file>"
end if
set pwd to do shell script "pwd"
set _input to item 1 of argv as text
View docx-to-pdf.scr
#!/usr/bin/osascript
on run argv
if not (count argv) = 2
return "Usage:\n docx-to-pdf <input file> <output file>"
end if
set pwd to do shell script "pwd"
set _input to item 1 of argv as text