Skip to content

Instantly share code, notes, and snippets.

Patrick Venture pstrinkle

Block or report user

Report or block pstrinkle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pstrinkle / mem.c
Last active May 20, 2016
memory-alignment for allocation in C
View mem.c
* In this example, we don't used fixed-length types, which bugs me, but the idea is that it has to work on memory-length numbers.
* So it takes long, which is memory address length. So, you can change it to uint64_t or uint32_t, or just ints or size_t if you want
* and it should mostly work. However, for this exmaple to be complete, I needed the rounding to support memory addresses as input.
/* 4KiB for this example. */
#define ALIGNMENT_SIZE 0x1000
#define NULL ((void*)0)
pstrinkle /
Last active Sep 16, 2018
My favorite interview questions

free-form answer

computer science (algorithms, architecture, data structures, and operating system theory)

  1. under what circumstances would you use an array over an linked-list (or other data structure)?
  2. what is the average search time for a binary search tree?
  • what can impact a binary search tree's performance metrics?
  • how can these algorithmic vulnerabilities be mitigated?
  1. what are at least two approaches to hash table insertion collisions?
  • what are the algorithmic costs to each?
  1. what is the difference between a process and a thread?
View launch_popup.js
* launch_popup
* Launch a popup for the url provided.
function launch_popup(url) {
var wwidth = $(window).width();
var wheight = $(window).height();
var width = (wwidth > 600) ? 600 : wwidth - 50;
Python that records information to compute daily active users for your site, assuming your site is running with python. :D (obviously)
Assumes you're concerned about the eastern timezone.
from redis import StrictRedis
from datetime import datetime
from pytz import timezone
View swampd sample configs
sensors config:::
type: fan
readpath: /xyz/openbmc_project/sensors/fan_tach/fan2
writepath: /sys/class/hwmon/hwmon0/pwm1
min: 0
max: 255
type: fan
You can’t perform that action at this time.