Skip to content

Instantly share code, notes, and snippets.

View mgalgs's full-sized avatar
🍔
pizza

Mitchel Humpherys mgalgs

🍔
pizza
View GitHub Profile
#include "section_hacking.h"
static void in_equotes(const char *txt)
{
printf("`%s'\n", txt);
}
REGISTER_FORMATTER(in_equotes);
#include "section_hacking.h"
static void in_equotes(const char *txt)
{
printf("`%s'\n", txt);
}
REGISTER_FORMATTER(in_equotes);
static void __init do_initcalls(void)
{
int level;
for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++)
do_initcall_level(level);
}
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define core_initcall(fn) __define_initcall("1",fn,1)
#define subsys_initcall(fn) __define_initcall("4",fn,4)
#define late_initcall(fn) __define_initcall("7",fn,7)
/* trimmed, obviously... */
Formatters are sitting from 0x0x601020 to 0x0x601050
Formatting with in_quotes: "My Formatted Text"
Formatting with in_equotes: `My Formatted Text'
Formatting with in_arrows: -->>>My Formatted Text<<<---
@mgalgs
mgalgs / Makefile
Last active April 11, 2018 17:09
ELF section hacking!
all: section_hacking
section_hacking:
gcc -g -O0 -Werror -Wall -o section_hacking section_hacking.c plugin.c
clean:
rm -f *.o section_hacking
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
isearch-search()
isearch-search-and-update()
(let ((string (concat "\\<" (buffer-substring-no-properties (progn (skip-syntax-backward "w_") (point)) (progn (skip-syntax-forward "w_") (point))) "\\>"))) (if (and isearch-case-fold-search (eq (quote not-yanks) search-upper-case)) (setq string (downcase string))) (setq isearch-string string isearch-message (concat isearch-message (mapconcat (quote isearch-text-char-description) string "")) isearch-yank-flag t) (isearch-search-and-update))
(progn (let ((string (concat "\\<" (buffer-substring-no-properties (progn (skip-syntax-backward "w_") (point)) (progn (skip-syntax-forward "w_") (point))) "\\>"))) (if (and isearch-case-fold-search (eq (quote not-yanks) search-upper-case)) (setq string (downcase string))) (setq isearch-string string isearch-message (concat isearch-message (mapconcat (quote isearch-text-char-description) string "")) isearch-yank-flag t) (isearch-search-and-update)))
(if (equ
@mgalgs
mgalgs / 1193.py
Last active December 15, 2015 16:09
Brute force http://xkcd.com/1193/
#!/usr/bin/env python3
# REQUIRES:
# pyskein http://pythonhosted.org/pyskein/
# python > 3.0 (due to pyskein)
#
# INSTALLATION:
# (install virtualenv)
# (install python3)
# virtualenv -p /path/to/python3 skein
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(message "hello, more %s!" "stuff")
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(message "hello, %s!" "stuff")