Skip to content

Instantly share code, notes, and snippets.

@heiher
heiher / mg90s.c
Last active November 16, 2020 03:09
外置硬盘盒电源开关伺服电机控制程序(树莓派init单进程版)
/*
============================================================================
Name : mg90s.c
Author : Heiher <r@hev.cc>
Copyright : Copyright (c) 2020 everyone.
Description : MG90S Motor Controller
============================================================================
*/
#include <poll.h>
@heiher
heiher / ecryptfs-mount
Created March 9, 2020 15:18
eCryptfs mounting helper
#!/bin/bash
if [ "$#" -lt 2 ]; then
SRC=$1
DST=$1
else
SRC=$1
DST=$2
fi
@heiher
heiher / wdtd.c
Last active March 6, 2020 04:28
Loongson 7A Watchdog Timer Userspace Daemon
#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/types.h>
@heiher
heiher / epoll.c
Created August 18, 2019 02:02
Why the edge-triggered mode doesn't work for epoll file descriptor itself?
#include <stdio.h>
#include <unistd.h>
#include <sys/epoll.h>
int
main (int argc, char *argv[])
{
int efd[2];
struct epoll_event e;