This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Ben Cohen, October 2017. | |
# | |
# mouse_motion.py: Display "breadcrumb trail" to test mouse motion events. | |
# | |
# Move the mouse and the positions of the motion events will be displayed. | |
# Clear the canvas by pressing Backspace. Quit by pressing Escape. | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Git post-commit hook to create a branch automatically when commiting from a | |
# detached HEAD. | |
# | |
# Install in your repo as .git/hooks/post-commit and make it executable. | |
# | |
# Ben Cohen, December 2017. | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ptrace_without_exec: Ptrace child process without calling exec() | |
* | |
* Compile using: | |
* gcc -o ptrace_without_exec ptrace_without_exec.c -ggdb -Wall | |
* | |
* Ben Cohen, May 2018. | |
*/ | |
#include <unistd.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# GDB Python pretty printer for the int datatype to Roman Numerals | |
# | |
# Ben Cohen, June 2019 | |
# | |
import gdb | |
# GDB pretty printer for the "int" type | |
class IntPrinter: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# GDB Python unwinder and frame decorator prototype | |
# | |
# This is a very basic demonstration for how to get GDB to unwind the | |
# "frametest" example crash in https://github.com/ben-cohen/corelibgen and | |
# apply a frame decorator to the backtrace. | |
# | |
# It needs a recent version of gdb and only works on i386 or x86_64. | |
# You need to manually fill in the PC value of the crash at "XXX" below! | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# fontlist.sh: Create a XeLaTeX document giving samples for each of the fonts | |
# available to the local system from fc-list, and run XeLaTeX on it ignoring | |
# errors. | |
# | |
# Ben Cohen, August 2020. | |
# | |
OUTFILE=fontlist.tex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% A LaTeX document where images called img-1.jpg, img-2.jpg, ... are | |
% displayed in the corner of the page instead of a textual page number. | |
% | |
% Ben Cohen, November 2020 | |
% | |
\documentclass{article} | |
\usepackage{lipsum} | |
\usepackage{graphicx} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: diffpdf.sh file_1.pdf file_2.pdf | |
# requirements: | |
# - ImageMagick | |
# - Poppler's pdftoppm and pdfinfo tools (works with 0.18.4 and 0.41.0, | |
# fails with 0.42.0) | |
# (could be replaced with Ghostscript if speed is | |
# not important - see commented commands below) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# git_check_status.sh: check whether git is in a special state | |
# | |
# Ben Cohen, July 2021 | |
# | |
# This script returns failure if the current directory is a git worktree | |
# that is in a special state - merge, rebase, bisect or detached HEAD - or | |
# returns success if the worktree is in a normal state, or the current | |
# directory is not a git worktree. |
OlderNewer