Skip to content

Instantly share code, notes, and snippets.

View sgielen's full-sized avatar

Sjors Gielen sgielen

View GitHub Profile
@sgielen
sgielen / Makefile
Created June 3, 2021 21:44
macfuse testcase
main: main.cpp
g++ -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse/fuse -lfuse main.cpp -o main -std=c++11 -Wall -Wextra
@sgielen
sgielen / check-zfs-status
Created May 28, 2018 14:19
ZFS management scripts
#!/bin/bash
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
state=$(zpool status | grep state)
if [ "$state" != " state: ONLINE" ]; then
echo "Zpool status state is not ONLINE"
zpool status
exit 1
fi
@sgielen
sgielen / # qemu - 2017-07-07_17-03-05.txt
Created July 21, 2017 11:37
qemu on macOS 10.12.5 - Homebrew build logs
Homebrew build logs for qemu on macOS 10.12.5
Build date: 2017-07-07 17:03:05
@sgielen
sgielen / CMakeLists.txt
Created February 5, 2017 11:39
Building kernel with CMake, clang and binutils ld
cmake_minimum_required(VERSION 2.8.12)
project(MyKernel C CXX ASM)
# ...
add_executable(mykernel boot.s kernel_main.cpp) # + other source files
set_target_properties(mykernel PROPERTIES LINK_DEPENDS "${CMAKE_SOURCE_DIR}/linker.ld")
set_target_properties(mykernel PROPERTIES LINK_FLAGS "-T ${CMAKE_SOURCE_DIR}/linker.ld")
--- Failing tests ---
total number of failing tests: 68
total number of succeeding tests: 890
* clocks are not supported together with locks/condvars yet
- cnd_timedwait::success
- cnd_timedwait::timedout
- mq_timedreceive::bad
- mq_timedreceive::blocking
- mq_timedsend::bad
- mq_timedsend::blocking
#!/usr/bin/perl
use strict;
use warnings;
my $email = 'letsencrypt@sjor.sg';
my $sslroot = '/etc/ssl/private';
# This script assumes every hostname under __DATA__ has its .well-known pointing to the following directory:
my $webroot = '/var/www/well-known';
while(<DATA>) {
@sgielen
sgielen / hog.cpp
Created April 21, 2014 13:13
Need some resident memory usage? This cpp file constantly allocates sizeof(uint64_t)+sizeof(void*) of it and tries to keep it out of swapped memory.
#include <stdint.h>
#include <stdio.h>
struct node_t {
node_t() : i(0), previous(0) {}
node_t(node_t *previous) : i(previous->i + 1), previous(previous) {}
uint64_t i;
node_t *previous;
};
@sgielen
sgielen / .gitignore
Last active November 23, 2023 01:09
Clang plugin by John Bartholomew for finding globals and non-const static variables, unpacked
warnglobals.so
@sgielen
sgielen / foo.cpp
Last active December 17, 2015 20:18
librusql-voorbeeldcode voor in libvreemd
std::string url = "unix:///tmp/mysql.sock";
std::string user = "root";
std::string pass = "";
std::string database = "foo";
rusql::connection c;
try {
c = rusql::connection(url, user, pass, database);
} catch(rusql::sql_connection_error &e) {
sjors@foo:/tmp$ cat main.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
long bar = strtol(argv[1], NULL, 10);
printf("bar = %ld\n", bar);
int foo = 5 / bar;
printf("I'm still here\n");
return 0;