Skip to content

Instantly share code, notes, and snippets.

View galch's full-sized avatar
🎯
Focusing

Steve Han galch

🎯
Focusing
View GitHub Profile
@ryankurte
ryankurte / uart.c
Last active August 12, 2024 03:24
Simple unix serial implementation. This uses pthreads to receive and buffer incoming data for later use.
#include "uart.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@ddre54
ddre54 / redis_keys_clear_pattern_matching.lua
Last active October 1, 2024 09:02
Remove all the keys from redis matching a pattern
--Starting with redis 2.6.0, you can run lua scripts
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 prefix:*
--For big number of keys
EVAL "local keys = redis.call('keys', ARGV[1]) \n for i=1,#keys,5000 do \n redis.call('del', unpack(keys, i, math.min(i+4999, #keys))) \n end \n return keys" 0 prefix:*