Skip to content

Instantly share code, notes, and snippets.

@bensenq
bensenq / set_irq_affinity.sh
Created July 22, 2019 14:35
set_irq_affinity
#!/bin/bash
#
# Copyright (c) 2014, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@bensenq
bensenq / pcimem.c
Created January 2, 2018 08:04
The pcimem application provides a simple method of reading and writing to memory registers on a PCI card. https://github.com/billfarrow/pcimem
/*
* pcimem.c: Simple program to read/write from/to a pci device from userspace.
*
* Copyright (C) 2010, Bill Farrow ([email protected])
*
* Based on the devmem2.c code
* Copyright (C) 2000, Jan-Derk Bakker ([email protected])
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@bensenq
bensenq / read-utmp-file.c
Last active May 17, 2016 13:57 — forked from eerpini/read-utmp-file.c
sample code to read the unix session log utmp
#include <utmpx.h>
#include <paths.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv){
struct utmpx data;
FILE *log_file = fopen(_PATH_UTMP, "r");
memset(&data, 0, sizeof(struct utmpx));
@bensenq
bensenq / getmd5.c
Created May 11, 2016 15:36
calculate md5sum using libcrypto
/* crypto/md5/md5test.c */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
#define LOG_FATAL (1)
#define LOG_ERR (2)
#define LOG_WARN (3)
#define LOG_INFO (4)
#define LOG_DBG (5)
#define LOG(level, ...) do { \
if (level <= log_level) { \
fprintf(log_stream, ##__VA_ARGS__); \
fflush(log_stream); \
@bensenq
bensenq / list.h
Created May 6, 2016 14:38
list structure implement in glusterfs
/*
Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
#ifndef _LLIST_H