Skip to content

Instantly share code, notes, and snippets.

YAMAMOTO Masaya pandax381

Block or report user

Report or block pandax381

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pandax381
pandax381 / ipmond.c
Created May 17, 2019
Detect add/delete IP address to interface on Linux
View ipmond.c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <linux/rtnetlink.h>
#include <linux/if.h>
@pandax381
pandax381 / tcptwreuse.py
Last active Apr 18, 2019
Trace reuse TCP connection in TIME_WAIT state
View tcptwreuse.py
#!/usr/bin/python
from __future__ import print_function
from bcc import BPF
from socket import inet_ntop, ntohs, AF_INET, AF_INET6
from struct import pack
b = BPF(text="""
#include <uapi/linux/ptrace.h>
#include <net/sock.h>
@pandax381
pandax381 / image
Created Jul 10, 2018
/usr/share/initramfs-tools/scripts/image
View image
# -*- shell-script -*-
image_mount_storage()
{
local mnt="$1"
local_top
local_device_setup "${ROOT}" "usb storage"
ROOT="${DEV}"
@pandax381
pandax381 / arduino-esp32-mruby.md
Last active Jun 25, 2018
arduino-esp32 に mruby を組み込む手順
View arduino-esp32-mruby.md

mruby本体の準備

$ export ARDUINO_ESP32_ROOT=$HOME/Documents/Arduino/hardware/espressif/esp32
$ cd $ARDUINO_ESP32_ROOT
$ mkdir mruby
$ cd mruby
$ git clone https://github.com/mruby/mruby.git
$ cd mruby 
$ git checkout 1.4.1
View arduino-esp-mruby.ino
#include <stdint.h>
#include "sdkconfig.h"
#include "mruby.h"
#include "mruby/irep.h"
#include "mruby/compile.h"
#include "mruby/error.h"
#include "mruby/string.h"
const uint8_t mrbcode[] = {
0x45,0x54,0x49,0x52,0x30,0x30,0x30,0x34,0x4f,0x5a,0x00,0x00,0x01,0x47,0x4d,0x41,
View nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
gshadow: files
@pandax381
pandax381 / softfloat_test2.c
Created Aug 17, 2017
Berkeley SoftFloat test 2
View softfloat_test2.c
#include <stdio.h>
#include "softfloat.h"
int
main (void) {
float32_t a = {0x3F800000};
float32_t b = {0x40000000};
float32_t c = f32_add(a, b);
fprintf(stderr, "0x%x (%ld) + 0x%x (%ld) = 0x%x (%ld)\n",
@pandax381
pandax381 / softfloat_test.c
Last active Aug 17, 2017
Berkeley SoftFloat test
View softfloat_test.c
#include <stdio.h>
#include "softfloat.h"
int
main (void) {
float32_t a = ui32_to_f32(0x3F800000); /* 1.0 */
float32_t b = ui32_to_f32(0x40000000); /* 2.0 */
float32_t c = f32_add(a, b);
fprintf(stderr, "0x%lx + 0x%lx = 0x%lx\n",
@pandax381
pandax381 / float_test.c
Created Aug 17, 2017
simple float test
View float_test.c
#include <stdio.h>
#include <stdint.h>
int
main (void) {
float a = 1.0;
float b = 2.0;
float c = a + b;
fprintf(stderr, "sizeof(float): %d\n", sizeof(float));
View connect_vs_raw.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
You can’t perform that action at this time.