Skip to content

Instantly share code, notes, and snippets.

View Kijewski's full-sized avatar

René Kijewski Kijewski

View GitHub Profile
@Kijewski
Kijewski / any-key.rs
Created January 21, 2025 22:26
Wait for any key to be pressed
use rustix::{event, fd, io, stdio, termios};
pub fn pause() -> Result<(), io::Errno> {
let attrs = termios::tcgetattr(FD)?;
// clear any stray input from STDIN
let _ = termios::tcflush(FD, termios::QueueSelector::IFlush);
// set STDIN to trap ctrl+c, etc., disable line mode, don't echo input
let mut new_attrs = attrs.clone();
#!/usr/bin/python
# encoding: UTF-8
from os import (
close, open, read, write,
O_WRONLY, O_APPEND, O_CREAT, O_EXCL, O_NOCTTY,
)
from sys import argv
from zlib import compressobj, DEFLATED, Z_DEFAULT_STRATEGY
@Kijewski
Kijewski / screen_daemon.sh
Created July 4, 2012 20:08
Start a daemon inside a screen
#!/bin/sh
cd $FOLDER
screen -dm -S $NAME -p 0 -s /bin/bash /bin/bash -c "$COMMAND | tee '$LOG_DIR/$(LANG_ALL=C date --rfc-3339=seconds)'.log" < /dev/null
@Kijewski
Kijewski / reg_nop()
Created March 4, 2012 09:54
an expensive, pipeline hostile nop
.global reg_nop
.macro round
xor %eax, %ebx
xor %ebx, %ecx
xor %ecx, %edx
xor %edx, %eax
.endm
.macro reg_rol