Skip to content

Instantly share code, notes, and snippets.

View uebayasi's full-sized avatar

Masao Uebayashi uebayasi

  • Tombi Inc.
  • Yokohama, Kanagawa, Japan
View GitHub Profile
@uebayasi
uebayasi / minimal-scapy-tcpreplay-ethernet.md
Created June 14, 2016 11:10
Sending a minimal Ethernet frame using Scapy and tcpreplay
# scapy
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
Welcome to Scapy (2.3.2)
>> x = Ether(src='00:11:22:33:44:55', dst='aa:bb:cc:dd:ee:ff')
>> wrpcap('x.pcap', x)
>> ^D
# ifconfig vether123 up
# ifconfig vether123 inet6 autoconf
# tcpreplay --intf1 vether123 x.pcap
Jumping to start of image at address 0xbfca0000
U-Boot 2012.04.01 (UBNT Build ID: 4605996-gd120a44) (Build time: Oct 14 2013 - 18:14:14)
Skipping PCIe port 0 BIST, in EP mode, can't tell if clocked.
Skipping PCIe port 1 BIST, reset not done. (port not configured)
BIST check passed.
UBNT_E200 r1:1, r2:9, serial #: 24A43C0634DA
Core clock: 800 MHz, IO clock: 600 MHz, DDR clock: 533 MHz (1066 Mhz DDR)
#0 0x00007f7ff710e74a in _lwp_kill () from /usr/lib/libc.so.12
#1 0x00007f7ff710e3d5 in abort () from /usr/lib/libc.so.12
#2 0x00007f7ff746a7d2 in default_fatal_finish ()
from /usr/pkg/lib/dovecot/libdovecot.so.0
#3 0x00007f7ff746a835 in i_internal_fatal_handler ()
from /usr/pkg/lib/dovecot/libdovecot.so.0
#4 0x00007f7ff7423031 in i_panic () from /usr/pkg/lib/dovecot/libdovecot.so.0
#5 0x00007f7ff789960d in index_mail_get_raw_headers ()
from /usr/pkg/lib/dovecot/libdovecot-storage.so.0
#6 0x00007f7ff78998f3 in index_mail_get_first_header ()
XXX 0x8001180068000010 <- 0x00002044
XXX 0x8001180068000010 <- 0x00022044
XXX 0x8001180068000010 <- 0x00022004
XXX 0x8001180068000018 <- 0x398d28080b000001
XXX 0x8001180068000018 <- 0x398d28080b000000
XXX 0x8001180068000010 <- 0x00022014
XXX 0x8001180068000018 <- 0x398d28080b000000
XXX 0x8001180068000010 <- 0x0002201c
XXX 0x8001180068000010 <- 0x0002203c
XXX 0x80016f0010000008 <- 0x01a1
  • Summary
    • Installing Redmine under sub-URI is hard
    • Input
      • Make Apache access localhost:3000/redmine
        • ProxyPass /redmine http://localhost:3000/redmine
      • Make Redmine process /redmine
        • Dynamic contents -> routing
          • Edit config/routes.rb
        • Static contents -> ???
          • XXX Doesn't work

Debugging

Use ld -Map=xxx.map and check the output. (Intuitive, no explanation needed.)

SECTIONS command: *(x y) vs *(x) *(y)

*(x y) merges sections by placing matched sections in the order they found.

*(x) *(y) merges sections by placing sections x first, then y

Save workspace as ASCII

options(save.image.defaults=list(ascii=T))
@uebayasi
uebayasi / beamer-chalkboard-font.tex
Created August 29, 2014 10:00
How to use "Chalkboard SE" (Comic Sans equivalent available on Mac OS X) for Beamer presentation
\documentclass{beamer}
:
\usepackage{fontspec}
\setsansfont{Chalkboard SE}
:
\begin{document}
:
\end{document}
@uebayasi
uebayasi / coccinelle-bsd-src-sys.sh
Created July 21, 2014 16:37
How to use coccinelle (spatch) for FreeBSD/OpenBSD/NetBSD
# The point: --macro-file sys/cdefs.h
cd /usr/src/sys
vim /tmp/hoge.cocci
spatch --macro-file sys/cdefs.h --sp-file /tmp/hoge.cocci (list of files)