Skip to content

Instantly share code, notes, and snippets.

View foxhoundsk's full-sized avatar

Huichun Feng foxhoundsk

View GitHub Profile
@senderle
senderle / hand-modify-pdf.md
Created September 23, 2020 15:03
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

@nadavrot
nadavrot / Matrix.md
Last active July 16, 2024 10:05
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@croepha
croepha / main.cpp
Created December 15, 2016 18:09
Example of calling into the kernel vdso directly
#include <stdio.h>
#include <sys/auxv.h> // For getauxval and AT_SYSINFO_EHDR
#include <string.h>
#include <elf.h>
typedef unsigned char u8;
void* vdso_sym(char* name) {
// in order to semantically inline getauxval one would have to bypass glibc, as the auxval is passed
// by the kernel to the bin's entrypoint used by the kernel
@Lanchon
Lanchon / stm32cubemx-linux.md
Last active August 4, 2023 08:54
Installing STM32CubeMX on Linux

Installing STM32CubeMX on Linux

The STM32CubeMX tool is written in portable java, but unfortunately it is distributed as a Windows executable embedded in a Windows installer.

To install it on Linux:

  1. sudo java -jar SetupSTM32CubeMX-4.11.0.exe
  2. install the tool somewhere in your home, eg: /home/you/stm32/cubemx
  3. sudo chown -R you:you /home/you/stm32/cubemx
@shamil
shamil / mount_qcow2.md
Last active July 16, 2024 22:52
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
@neofob
neofob / KernelHeaders.md
Created July 5, 2013 20:01
KernelHeaders on KernelNewbies.org

Header files in the Linux kernel are used for two purposes:

  1. to define interfaces between components of the kernel, and
  2. to define interfaces between the kernel and user space

== Internal modules ==

Internal interfaces between modules are defined anywhere in below linux/include/ or linux/arch/*/include/. Interfaces between source files in a single module should be put into the same directory as the module source code, which avoids polluting the global header space.

== External modules ==