Skip to content

Instantly share code, notes, and snippets.

View bave's full-sized avatar

inoue.tomoya bave

View GitHub Profile
@bave
bave / hoge.yaml
Created April 5, 2022 06:59
hoge
diagram:
fill: "white"
columns: 20
rows: 20
gridLines: true
title:
author: bebebe
company: nict
color: black
text: rd.enobed 172.19.0.0/16
// +avx, +popcnt, +bmi2
unsafe fn mm256_compressstroeu_ps(array: *mut f32, mask: u8, src: __m256)
{
let convert = _pext_u64(0x0706050403020100, _pdep_u64(mask as u64, 0x0101010101010101)*0xFF);
let permute = _mm256_cvtepu8_epi32(_mm_cvtsi64_si128(convert as i64));
let compress = _mm256_permutevar8x32_ps(src, permute);
let imm8 = _popcnt64(mask as i64);
let ret = match imm8 {
0 => { _mm256_blend_ps(_mm256_loadu_ps(array), compress, 0x00) },
@bave
bave / sample_tap.cpp
Created February 25, 2019 13:42
tapのサンプル
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <net/if.h>
/*
unsigned int if_nametoindex(const char *ifname);
char *if_indextoname(unsigned int ifindex, char *ifname);
*/
@bave
bave / sample_thread_sigwait.c
Last active February 15, 2019 20:40
sigwaitとスレッドのサンプル
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <pthread.h>
#include <sys/epoll.h>
#include <sys/signalfd.h>
@bave
bave / sample_waitpid.c
Created January 29, 2019 14:29
waitpidのサンプル
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int child()
{
int count = 10;
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install htop
sudo apt-get install build-essential
sudo apt-get install libncurses-dev
sudo apt-get install libssl-dev
sudo apt-get install bc
sudo apt-get install linux-source
sudo -s
@bave
bave / gist:20893af9bd2c52190add
Last active January 24, 2016 12:54
freebsd: kernel proc and thread on kernel module
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
@bave
bave / pktgen_sample.sh
Created May 19, 2015 16:30
pktgen script sample
#!/bin/sh
#modprobe pktgen
ETH="eth0"
CLONE_SKB="clone_skb 10"
PKT_SIZE="64"
DELAY="0"
SRC_MAC="00:26:2d:08:8b:25"
DST_MAC="00:26:2d:08:99:fb"
@bave
bave / gist:c5c218db8b54fa9b90fe
Created October 18, 2014 19:08
customize-freebsd-live-cd
#!/bin/sh
#fetch freebsd-live.iso
mkdir hoge
bsdtar -C hoge -pxvf freebsd-live.iso
cd hoge
# --------
# 書き換え
# --------
mkisofs -v -b boot/cdboot -no-emul-boot -r -J -V "FREEBSD_INSTALL" -o ../freebsd_customize.iso ./
@bave
bave / gist:e3abb7ddea9913c58168
Last active March 28, 2018 09:15
linux netmap patch script
#!/usr/bin/env sh
cd /tmp
apt-get update
apt-get -y install git build-essential
apt-get -y install linux-source linux-headers-generic
tar xvf /usr/src/linux-source-`uname -r | awk 'BEGIN { FS="-" } { print $1 }'`.tar.bz2 -C /usr/src
git clone https://github.com/luigirizzo/netmap.git
cd netmap/LINUX
SRC_VAR=/usr/src/linux-source-`uname -r | awk 'BEGIN { FS="-" } { print $1 }'`
./configure --kernel-sources=${SRC_VAR}