Skip to content

Instantly share code, notes, and snippets.

@ae-s
ae-s / pngcap.py
Created September 21, 2020 05:43
pcap to png
#!/usr/local/bin/python3
from pcapfile import savefile
from PIL import Image
import sys
# turn a pcap into an image.
# each row of the image is one packet from the capture.
cap = open(sys.argv[1], 'rb')
@ae-s
ae-s / unreal.c
Last active February 11, 2023 02:08
/* stupid C puzzle: without trying it in the computer, explain why
* does this not work
*/
#include <stdio.h>
#define NR1 5
#define NR2 4
#define NR3 3
#define NR4 2
; this defun ripped from http://www.emacswiki.org/emacs/narrow-indirect.el
(defun narrow-to-region-indirect-other-window (start end here text)
"`narrow-to-region' in a cloned indirect buffer in the other window.
The indirect buffer is named the same as the current buffer,
except it is suffixed by `:text'.
Non-interactively:
START and END are the region beginning and end.
HERE is where to place the cursor, relative to START.
TEXT is prefixed by `:' and appended to the
@ae-s
ae-s / neighsupdate.sh
Last active February 11, 2023 02:12
nsupdate $(ip neigh list)
#!/bin/bash
# Tiny tool to run as a cronjob, which will update
# (using nsupdate) your zone files to include dhcp-
# and statelessly-assigned addresses.
# Space-separated list of address-to-name resolution methods to try.
# They'll be tried in the order listed here.
METHODS="hostfile avahi localdns"
# Zone to update for each type of IP address. In my home network,
@ae-s
ae-s / Makefile
Last active February 11, 2023 02:06
# These are rules which don't correspond to an actual file
.PHONY: calibrate flatten
export MAGICK_TMPDIR=/tmp/3
# We maybe don't want to keep all these huge bitmaps lying around
#.INTERMEDIATE: out/%.ppm orig/%.ppm
# There is a tool ... which make knows how to compile ...
ppmunwarp: ppmunwarp.cc
@ae-s
ae-s / bbcode-quotes.txt
Last active February 11, 2023 02:04
bbcode is a nightmare
* bbcode is a nightmare
** quote formats
- [quote], [QUOTE]
- universal
- [quote name="{username}" post={post_id} timestamp={time_t}]
- [quote name="{username}" post={post_id}]
- [quote={username};{post_id}]
- vbulletin
- [QUOTED={username};{post_id}]
- kittyforums, rare
@ae-s
ae-s / unicode.7
Last active February 11, 2023 02:03
A manpage for unicode
This file has been truncated, but you can view the full file.
'\" t
.\" Copyright (c) 2013 Astrid Smith
.\" Created Sun Dec 22 21:21:39 PST 2013
.\"
.\" %%%LICENSE_START(WTFPL)
.\" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
.\" Version 2, December 2004
.\"
.\" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
.\"
@ae-s
ae-s / .bashrc
Last active February 11, 2023 01:48
Host-dependent automatic prompt colorization
#!/bin/bash
# Put the contents of this file in your .bashrc, to
# get a prompt that is automatically a distinct,
# stable color on every host you log into.
# ^O puts terminal back into default text mode for every prompt,
# preventing random glyphs.
resetterm="\[\017\]"
@ae-s
ae-s / c-switch-continue.c
Last active February 11, 2023 01:52
Example of continue within a case statement, in C
#include <stdio.h>
int main(void)
{
int i = 0;
while (i < 5) {
i++;
printf("\n%d\n", i);
switch (i) {
case 1:
@ae-s
ae-s / xmodmap.onehand-colemak
Last active February 11, 2023 01:53
Single-hand keyboard with xmodmap
keycode 29 = j J g G
keycode 30 = l L p P
keycode 31 = u U f F
keycode 32 = y Y w W
keycode 33 = semicolon colon q Q
keycode 43 = h H d D
keycode 44 = n N t T
keycode 45 = e E s S
keycode 46 = i I r R
keycode 47 = o O a A