Skip to content

Instantly share code, notes, and snippets.

View WolleTD's full-sized avatar

Eicke Herbertz WolleTD

View GitHub Profile
@WolleTD
WolleTD / multiline-output.bash
Created March 31, 2021 10:18
tput experiments
#!/bin/bash -e
termHeight=$(tput lines)
dispRows=6
startRow=$((termHeight - dispRows - 1))
linesWritten=0
pids=()
fds=()
function dummy() {
@WolleTD
WolleTD / parallel_async.cpp
Last active March 5, 2021 12:56
Initiate multiple operations on multiple io objects in parallel and wait for all of them to complete
#include <fmt/format.h>
#include <asio.hpp>
#include <memory>
#include <sstream>
template <typename... Ts> struct overloaded : public Ts... {
using Ts::operator()...;
};
template <typename... Ts> overloaded(Ts...) -> overloaded<Ts...>;
@WolleTD
WolleTD / opening_times.cpp
Last active July 19, 2020 23:13
opening times
#include <iostream>
#include <map>
#include <chrono>
// From https://github.com/HowardHinnant/date/blob/master/include/date/date.h
#include "date.h"
using namespace date;
using namespace std::chrono;
struct shoptimes {
@WolleTD
WolleTD / 277777788888899.py
Created March 23, 2019 01:11
277777788888899
#!/usr/bin/env python
from datetime import datetime
import timeit
def a(n):
steps = 0
while n > 9:
steps += 1
k = 1
@WolleTD
WolleTD / alphablending.py
Last active January 3, 2019 13:18
Alphablending Test
#!/usr/bin/env python3
def alphablend(pix, val, a):
# Input value is implicitly scaled by 256
alpha = a
nalpha = 256 - a
# Output value doesn't require any higher precision than
# dividing by 256 (>>8)
return ((val * alpha + pix * nalpha) >> 8) & 255
@WolleTD
WolleTD / dmesg
Last active September 23, 2016 11:12
dmesg iperf3 oom-killer
iperf3 invoked oom-killer: gfp_mask=0x40d0, order=0, oomkilladj=0
Hardware Trace:
0 Target : <0x00004b40> { _dump_stack + 0x0 }
Source : <0x00034aac> { _oom_kill_process + 0xd0 } CALL pcrel
1 Target : <0x00034aac> { _oom_kill_process + 0xd0 }
Source : <0x0000fcf2> { _printk + 0x16 } RTS
2 Target : <0x0000fcee> { _printk + 0x12 }
Source : <0x00010350> { _vprintk + 0x170 } RTS
3 Target : <0x00010348> { _vprintk + 0x168 }
Source : <0x000104b4> { _vprintk + 0x2d4 } JUMP.S