Skip to content

Instantly share code, notes, and snippets.

@kunalb
kunalb / args_tables.sh
Created October 19, 2023 00:49
Testing out argument handling
#!/bin/bash
set -u
suffixes=( "-" ":-" "+" ":+" "+x" ":+x" )
function header {
printf "%10s | " "\$#"
printf "%10s | " "\$*"
for predicate in "-n" "-z"; do
for suffix in "${suffixes[@]}"; do
@kunalb
kunalb / capture.py
Created September 9, 2023 17:28
Capture stderr
import ctypes
import os
import threading
class StderrCapture:
def __init__(self, f):
self.libc = ctypes.CDLL('libc.so.6')
self.memfd_create = self.libc.memfd_create
self.memfd_create.argtypes = [ctypes.c_char_p, ctypes.c_uint]
self.memfd_create.restype = ctypes.c_int
--- /etc/systemd/logind.conf 2022-03-26 11:58:23.739031451 -0400
+++ /etc/systemd/logind.conf.dpkg-new 2022-09-09 14:47:16.000000000 -0400
@@ -1,13 +1,16 @@
# This file is part of systemd.
#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
+# systemd is free software; you can redistribute it and/or modify it under the
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kunalb
kunalb / Terrorist Scanner 2.ipynb
Created May 9, 2021 14:29
BRML Terrorist Scanner Exercise
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kunalb
kunalb / Terrorist Scanner 2.ipynb
Created May 9, 2021 14:26
BRML Exercise: Terrorist Scanner
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kunalb
kunalb / Terrorist Scanner.ipynb
Created May 9, 2021 09:47
BRML Terrorist Scanner
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Thread 1 "glamoroustoolki" received signal SIGILL, Illegal instruction.
0x00007fffe5af7617 in ffi_closure_alloc () from /home/knl/build/gtoolkit/./lib/libffi.so.7
(gdb) bt
#0 0x00007fffe5af7617 in ffi_closure_alloc () from /home/knl/build/gtoolkit/./lib/libffi.so.7
#1 0x00007fffe5d0543a in callback_new (runner=0x7fffe5f08280 <sameThreadRunner>, parameters=0x555555839890, count=1, returnType=0x7fffe5afd1a0 <ffi_type_uint32>)
at /home/runner/work/threadedFFI-Plugin/threadedFFI-Plugin/plugin/src/callbacks/callbacks.c:43
#2 0x00007fffe5d05000 in primitiveRegisterCallback () at /home/runner/work/threadedFFI-Plugin/threadedFFI-Plugin/plugin/src/callbacks/callbackPrimitives.c:136
#3 0x00007ffff7cdea2a in primitiveExternalCall () at /home/runner/work/opensmalltalk-vm/opensmalltalk-vm/build/generated/vm/src/gcc3x-cointerp.c:76740
#4 0x00007ffff7ced325 in interpret () at /home/runner/work/opensmalltalk-vm/opensmalltalk-vm/build/generated/vm/src/gcc3x-cointerp.c:6023
#5 0x00007ffff7cf1964 in enterSmalltalkExec
@kunalb
kunalb / TicTacToe.md
Last active May 2, 2020 18:50
RC Application: Tic Tac Toe