Skip to content

Instantly share code, notes, and snippets.

Usage: rpm [OPTION...]
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--triggeredby query the package(s) triggered by the package
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/errno.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/uio.h>
static d_open_t hello_open;
@NanXiao
NanXiao / server.go
Created August 11, 2016 10:42
server.go
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
"encoding/json"
"strconv"
"sync"
)
package main
import (
"fmt"
"net/http"
"encoding/json"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.clever.com/v1.1/sections", nil)
@NanXiao
NanXiao / nccl_ex.cu
Last active December 22, 2017 09:43
/* compile:
* /opt/cuda/bin/nvcc -ccbin g++ -gencode=arch=compute_60,code=sm_60 -std=c++11 -O3 -I/usr/local/nccl/include/ -L/opt/cuda/lib64 -lcudart -lrt -L/usr/local/nccl/lib -lcurand -lnccl -lnvToolsExt -o nccl_ex nccl_ex.cu
*/
#include "nccl.h"
#include <stdio.h>
#define GPU_COUNT (4)
#define CUDACHECK(cmd) do { \
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#define CPU_NUM (104)
#define LOOP_NUM (100)
#define ARRAY_SIZE (CPU_NUM * LOOP_NUM)
double a[ARRAY_SIZE], b[ARRAY_SIZE], c[ARRAY_SIZE];
@NanXiao
NanXiao / bfd_test.c
Created October 17, 2017 03:01
A simple bfd usage example
#define PACKAGE "bfd_test"
#include <iostream>
#include <bfd.h>
int main(int argc, char** argv)
{
if (argc == 1)
{
std::cout << "Lack input file!\n";
return 1;
@NanXiao
NanXiao / nmi-interrupts.txt
Created May 27, 2019 05:22 — forked from wmealing/nmi-interrupts.txt
NMI interrupts and the joy they bring.
A non-maskable interrupt (NMI) is an interrupt type which differs from standard interrupt mechanism by enforcing attention from the interrupt processor (usually the CPU). This solution discusses an NMI is in more depth and how they are handled.
### What is an Interrupt ? ###
Modern systems architecture has created tightly coupled connect between system components. Work for components can be handed off to a component for completion. Rather than wait for the component the main CPU can be tasked to do other pending work.
When the component has completed its work it will raise a signal to the main processor. The main processor considers this signal an "interrupt", as the current work on the CPU will be interrupted immediately Each component has a number assigned to it.
### Why "mask" an interrupt ? ###
@NanXiao
NanXiao / parse_mem_info.cpp
Created June 4, 2019 05:59
Parse /proc/meminfo file
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
int main()
{
const std::string meminfo_file("/proc/meminfo");
std::ifstream ifs(meminfo_file);
# If you're looking into the C10M problem (10 million concurrent connections)
# you might want to play with DPDK (Originally proprietry Intel, now open source)
#
# C10M: http://c10m.robertgraham.com/
# DPDK: http://dpdk.org/
#
# This is a quick summary how to install dpdk on ubuntu
# running inside virtualbox on a mac
# On my Mac: