Skip to content

Instantly share code, notes, and snippets.

@mentha
mentha / ghrget.py
Created May 3, 2022 13:27
fetch assets from github release
#!/usr/bin/env python3
import argparse
import logging
import os
import re
import requests
import shutil
import subprocess as sp
import tempfile
@mentha
mentha / usbip-vhci_hcd_filter.patch
Created March 18, 2018 14:55
Linux usbip patch
diff -udr a/libsrc/vhci_driver.c b/libsrc/vhci_driver.c
--- a/libsrc/vhci_driver.c 2018-03-18 22:07:40.126034770 +0800
+++ b/libsrc/vhci_driver.c 2018-03-18 22:10:22.405106067 +0800
@@ -150,7 +150,12 @@
static int vhci_hcd_filter(const struct dirent *dirent)
{
- return strcmp(dirent->d_name, "vhci_hcd") >= 0;
+ size_t l = strlen(dirent->d_name);
+ if (l < 8)
@mentha
mentha / httpd.sh
Last active March 10, 2018 03:52
Simple HTTP Server in shell command language
#!/bin/sh
# This is free and unencumbered software released into the public domain.
if (file &> /dev/null; test $? -eq 127); then
file () {
# file -Lbi file
local l_mime
case "$(echo "$2" | rev | cut -d . -f1 | rev)" in
html) l_mime=text/html;;
css) l_mime=text/css;;
@mentha
mentha / statusled.c
Created January 27, 2018 13:15
RPI status led showing system load
#define _DEFAULT_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/sysinfo.h>
#define LEDCTL "/sys/class/leds/led0/brightness"