Skip to content

Instantly share code, notes, and snippets.

View xiangchu0's full-sized avatar

xiangchu xiangchu0

View GitHub Profile
@xiangchu0
xiangchu0 / erlang-env.el
Created October 16, 2019 06:47
emacs mode setting
(require 'erlang)
(require 'company-erlang)
(add-hook 'erlang-mode-hook #'company-erlang-init)
(add-to-list 'load-path "~/.emacs.d/pkg/distel/elisp")
(require 'distel)
(distel-setup)
(defconst distel-shell-keys
'(("\C-\M-i" erl-complete)
("\M-?" erl-complete)
@xiangchu0
xiangchu0 / dnsmasq-filter-aaaa.patch
Created October 8, 2019 12:25
dnsmasq-filter-aaaa.patch
From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
From: Bearice Ren <[email protected]>
Date: Tue, 20 Sep 2016 11:52:08 +0800
Subject: [PATCH] add filter-aaaa option
---
src/dnsmasq.h | 3 ++-
src/option.c | 3 +++
src/rfc1035.c | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
@xiangchu0
xiangchu0 / memory_layout.md
Created September 26, 2019 02:49 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@xiangchu0
xiangchu0 / erlang-after-arrow.el
Created July 29, 2019 01:41 — forked from robertoaloi/erlang-after-arrow.el
Improvement to the Erlang Mode for Emacs: Do not jump to a new line after -> when writing specs.
(defun erlang-after-arrow ()
"Return true if point is immediately after a function arrow (`->').
Make a special case when in a spec line."
(and
(save-excursion
(beginning-of-line)
(not (save-match-data (looking-at "-\\(spec\\|type\\)"))))
(and (>= (point) 2)
(and
(save-excursion
@xiangchu0
xiangchu0 / freebsd-tips.org
Created July 12, 2019 11:30
FreeBSD tips

get FreeBSD kernel

fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz

tar -C / -xvf /tmp/src.txz

svn checkout https://svn.freebsd.org/base/releng/`uname -r | cut -d'-' -f1,1` /usr/src

How to colorize output of git?

git config --global color.ui always
git config --global color.branch always
git config --global color.diff always
git config --global color.interactive always
git config --global color.status always
git config --global color.grep always
git config --global color.pager true
# /etc/sysct.conf
# only values specific for ipsec/l2tp functioning are shown here. merge with existing file
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1

create net

ip tuntap add name tap01 mode tap
ip tuntap add name tap02 mode tap
ip tuntap add name tap03 mode tap

ip link set tap01 up
ip link set tap02 up
ip link set tap03 up
@xiangchu0
xiangchu0 / makefile
Created May 3, 2019 14:36
makefile template
# ------------------------------------------------
# Generic Makefile
#
# Author: [email protected]
# Date : 2011-08-10
#
# Changelog :
# 2010-11-05 - first version
# 2011-08-10 - added structure : sources, objects, binaries
# thanks to http://stackoverflow.com/users/128940/beta