Skip to content

Instantly share code, notes, and snippets.

@xiangchu0
xiangchu0 / getksym.sh
Created February 7, 2023 15:09
simple script to add symbol file information for kernel debug
#!/bin/sh
function getsym() {
KMOD=$1
KDIR=/lib/modules/$(uname -r)/kernel/
KSYS=/sys/module/${KMOD}
KPATH=$(find ${KDIR} -name ${KMOD}.ko -o -name ${KMOD/_/-}.ko)
KFILE=${KPATH/$KDIR/./}
echo -n "add-symbol-file $KFILE"
for SEC in .text .bss .data .rodata
#!/bin/bash
#
# Copyright (c) 2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@xiangchu0
xiangchu0 / mount_qcow2.md
Created April 27, 2021 04:32 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8

Goal

I would like to get value of advertise-interval in vrrp-group 100. And I would like to use Perl API.

show config

interfaces {

@xiangchu0
xiangchu0 / _usr_local_bin_ecc
Created December 4, 2020 02:41
emacs script
#!/usr/bin/env bash
# Open file on a remote Emacs server.
# https://andy.wordpress.com/2013/01/03/automatic-emacsclient/ with added sudo.
# /usr/local/bin/ecl -> ecc
# /usr/local/bin/ecr -> ecc
# /usr/local/bin/ecs -> ecc
EMACS_HOME=/1/emacs/bin/
params=()
sudo=0
@xiangchu0
xiangchu0 / gist:9084d42cdf55132a42fa93d569304278
Created October 15, 2020 02:57 — forked from sunnyone/gist:4950c54d7cf89883ff4d
VyOS mount process while booting
initrd内init: scripts/liveをkickする存在
maybe_break mount
log_begin_msg "Mounting root file system"
. /scripts/${BOOT}
parse_numeric ${ROOT}
maybe_break mountroot
mountroot
log_end_msg
@xiangchu0
xiangchu0 / gdbinit
Created September 17, 2020 04:13 — forked from CocoaBeans/gdbinit
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@xiangchu0
xiangchu0 / GitConfigHttpProxy.md
Created August 24, 2020 01:17 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@xiangchu0
xiangchu0 / kvm-qemu.sh
Created December 11, 2019 08:38 — forked from doomedraven/kvm-qemu.sh
Linux - KVM + QEMU installer from sources :)
#!/bin/bash
#
# For latest version please check https://github.com/doomedraven/Tools/blob/master/Virtualization/kvm-qemu.sh
#
# https://www.doomedraven.com/2016/05/kvm.html
# Use Ubuntu 18.04 LTS
@xiangchu0
xiangchu0 / netpps
Created November 8, 2019 05:46
linux network monitoring script
#!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo