Skip to content

Instantly share code, notes, and snippets.

@sora
sora / Makefile
Created September 16, 2012 07:15
Lattice Diamond: command-line build
BOARD_DIR=../rtl
CORES_DIR=../../../cores
BOARD_NAME="LatticeECP3"
DEVICE_NAME="LFE3-35EA"
PKG_NAME="FPBGA484"
PER_GRADE=8
SEARCH_PATH="/usr/local/diamond/2.0/ispfpga/ep5c00/data"
include common.mak
import struct
import re
ipfile = open("scanner_uniq.dat", 'r')
print('# CIDR, Number_of_prefixes')
for cidr in range(1, 33):
prefixes = dict()
@sora
sora / Makefile
Last active March 22, 2018 02:42
Ethernet FCS calculation
all:
gcc -Wall eth_fcs.c -o fcs -lz
clean:
rm -f fcs
#!/usr/bin/bash
set -eu
Path=/sys/bus/pci/devices
DevList=`ls /sys/bus/pci/devices/`
Vender_id="0x8086"
Device_id="0x1563" # Intel x550
@sora
sora / test.c
Created February 11, 2017 15:32
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(void)
{
int fd0;
@sora
sora / RX_setup-if.sh
Created November 15, 2016 16:21
performance evaluation (TX: netmap, RX: mgcap)
#!/bin/bash
ifname="enp1s0f1"
ip_addr="192.168.100.13"
mtu_size="1500"
echo "${ifname} is assigned as ${ip_addr}."
sudo ifconfig ${ifname} ${ip_addr} netmask 255.255.255.0 up
echo "MTU of ${ifname} is changed into ${mtu_size}"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, random
import nfc
import pprint
#import requests
import binascii
usbid = 'usb:054c:06c3'
#!/bin/bash
HOST=`hostname`
IP_CMD=`/sbin/ip addr show dev eth0 | /bin/grep 'inet '`
MSG="${HOST}: ${IP_CMD}"
/usr/bin/curl https://docs.google.com/forms/d/{id}/formResponse -d ifq -d entry.836766723="${MSG}" -d submit=Submit

Keybase proof

I hereby claim:

  • I am sora on github.
  • I am sora (https://keybase.io/sora) on keybase.
  • I have a public key whose fingerprint is 2C26 04D3 5CB3 9180 D5A4 52D8 7F7E 50A3 83E5 9D2A

To claim this, I am signing this object:

@sora
sora / ping.sh
Created December 22, 2013 10:01
#!/bin/bash
#
# usage: ./ping.sh </dev/ethpipe/0
#
TEMP_DIR="/tmp/"
MY_PORT="0"
SRC_MAC_ADDR="000000000011"
DST_MAC_ADDR="A0369F1850E5"
SRC_IP_ADDR="0A 00 00 6E"