Skip to content

Instantly share code, notes, and snippets.

View chrisaycock's full-sized avatar

Christopher C. Aycock chrisaycock

View GitHub Profile
@chrisaycock
chrisaycock / pcap_udp.cpp
Last active December 22, 2023 11:04
Example for accessing UDP packets in a pcap file
// answer to https://quant.stackexchange.com/q/55088/35
// compile with c++ pcap_udp.cpp -lpcap
#include <iostream>
#include <pcap/pcap.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active June 25, 2024 07:29
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@zaius
zaius / background.sh
Created January 16, 2011 23:29
How to redirect a running process output to a file and log out
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@robbywalker
robbywalker / v1_level3.py
Created October 21, 2010 23:05
David Koblas's one-liner for GPCv1 Level 3
from itertools import combinations, chain
nums = tuple([int(v) for v in "3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99".split(' ') if v.strip()])
print sum([1 for v in chain(*[combinations(nums, r) for r in range(3, len(nums))]) if sum(v[0:-1]) == v[-1]])