Skip to content

Instantly share code, notes, and snippets.

#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... */
@dhilst
dhilst / Makefile
Last active August 18, 2021 03:15
sysfs + character device buffer example
obj-m += cdev03.o
KDIR ?= /home/geckos/abs/linux/src/linux-3.9/
all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
@Starefossen
Starefossen / tmux-cheats.md
Last active May 9, 2025 00:57
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@buzzdecafe
buzzdecafe / S.js
Last active April 18, 2024 11:55
S Combinator
/*
S : \x y z -> x z (y z)
*/
// S :: (z -> (a -> b)) -> (z -> a) -> z -> b
function S(x, y, z) {
return x(z)(y(z));
}
// example:
// add :: a -> a -> a
@sloria
sloria / bobp-python.md
Last active May 28, 2025 02:41
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@ShingoFukuyama
ShingoFukuyama / tabbar-config.el
Last active March 30, 2018 14:14
Configuration file. tabbar.el github https://github.com/dholm/tabbar
;;;tabbar github https://github.com/dholm/tabbar
;;http://d.hatena.ne.jp/tequilasunset/20110103/p1
;;http://d.hatena.ne.jp/plasticster/20110825/1314271209
(require 'tabbar)
(tabbar-mode 1)
;;; Don't enable mouse wheel on tab bar
(tabbar-mwheel-mode nil)
;;; Don't use group tab
@m6w6
m6w6 / acx_debug_cflags.m4
Created November 7, 2013 06:57
--enable-debug for autoconf
# gcc default/debug CFLAGS handling respecting user's CFLAGS
# avoid AC_PROG_CC setting -O2 CFLAGS which will override DEBUG_CFLAGS' -O0
# must be used right after AC_INIT
AC_DEFUN([ACX_DEBUG_CFLAGS], [
# ensure CFLAGS are set
AS_IF([test "${CFLAGS+set}"], [
USE_DEFAULT_CFLAGS=false
], [
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 30, 2025 22:04
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@willmcneilly
willmcneilly / push_new_branch_to_remote.sh
Created January 20, 2014 15:24
Push a new local branch to remote
$ git checkout -b mynewfeature
$ git push -u origin mynewfeature