Skip to content

Instantly share code, notes, and snippets.

PabloMansanet

Block or report user

Report or block PabloMansanet

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
View dmesg
[Nov29 21:07] Linux version 4.19.4-arch1-1-ARCH (builduser@heftig-22537) (gcc version 8.2.1 20180831 (GCC)) #1 SMP PREEMPT Fri Nov 23 09:06:58 UTC 2018
[ +0.000000] Command line: BOOT_IMAGE=(loop)/arch/boot/x86_64/vmlinuz module_blacklist=intel_lpss_pci img_dev=/dev/disk/by-uuid/df54812e-95b6-40ba-a398-e5d94d84d3fd img_loop=/boot/isos/halberd-2018.11.28-x86_64.iso earlymodules=loop
[ +0.000000] KERNEL supported cpus:
[ +0.000000] Intel GenuineIntel
[ +0.000000] AMD AuthenticAMD
[ +0.000000] Centaur CentaurHauls
[ +0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ +0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ +0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ +0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
View libinput_list-devices
Device: Power Button
Kernel: /dev/input/event2
Group: 1
Seat: seat0, default
Capabilities: keyboard
Tap-to-click: n/a
Tap-and-drag: n/a
Tap drag lock: n/a
Left-handed: n/a
Nat.scrolling: n/a
View sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +38.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +38.0°C (high = +100.0°C, crit = +100.0°C)
Core 2: +38.0°C (high = +100.0°C, crit = +100.0°C)
Core 3: +38.0°C (high = +100.0°C, crit = +100.0°C)
acpitz-acpi-0
Adapter: ACPI interface
View vulnerable.c
#include <stdio.h>
void innocentFunction(const char* userString)
{
char localBuffer[64];
sprintf(localBuffer, userString);
// [..]
}
View sample.c
void check(char *password)
{
size_t password_length;
char character_test;
uint char_counter;
int accumulator;
int number_from_char;
accumulator = 0;
View dependencies.md

A common pattern we use at BF is dependency injection through C++ abstract classes. This makes testing easy, but I have been wondering for a while if we can do better in how we implement the underlying principles. The conversation about Rust and mutability has helped me verbalize why I think C++ is limited when it comes to solving this problem.

Why dynamic dispatch?

At BF, we solve the problem of dependency injection with dynamic dispatch, even when the particular injection can be resolved at compile time. Here's a silly (and not great for reasons I'll explain later) example of what we sometimes do:

  • GpioInterface.hpp
View tubes.nim
import osproc
type
process_state = object
system_process: osproc.Process
proc process*(command: string): process_state =
result = process_state(
system_process: startProcess(
command: command
You can’t perform that action at this time.