Skip to content

Instantly share code, notes, and snippets.

@lelanthran
lelanthran / userContent.css
Created February 19, 2024 15:41
Place in "$FIREFOX_PROFILE/chrome" (case is important) and make HackerNews more readable
@-moz-document domain(news.ycombinator.com) {
.comment {
font-size: 12px;
line-height: 1.75em;
padding: 10px 0 10px 0;
max-width: 64ch;
display: block;
}
.commtext {
font-size: 12px;
@lelanthran
lelanthran / htmlq.c
Last active January 12, 2024 15:22
A simplistic tool to search HTML files.
/* ********************************************************
* Copyright ©2024 Rundata Systems. All rights reserved.
* This project is licensed under the GPLv3 License. You
* can find a copy of this license at:
* https://www.gnu.org/licenses/gpl-3.0.en.html
*/
#warning TODO: Split this into multiple files
#warning INCOMPLETE: Implement searching using compiled query
@lelanthran
lelanthran / verbose_proxy.c
Last active June 5, 2024 16:02
A small program to proxy and record all traffic to a server.
/* ********************************************************
* Copyright ©2024 Rundata Systems. All rights reserved.
* This project is licensed under the GPLv3 License. You
* can find a copy of this license at:
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* More detail (1m read):
* https://www.rundata.co.za/rundata/products/verbose_proxy
*
* Example usage (3m video):
@lelanthran
lelanthran / xgit
Created March 13, 2023 05:46
Use a stack to move between git branches.
#!/bin/bash
# Stores the current branch in a file so that popbranch can restore it later.
#
# Find the root of the git repo
while [ `ls -lad .git 2>&1 | grep -v 'No such file' | wc -l` -eq 0 ]; do
if [ $PWD == '/' ]; then
echo Not a git repo
@lelanthran
lelanthran / devlog-gen.sh
Last active August 17, 2023 06:43
Generate html devlog from chap1/content.md, chap2/content.md, etc
#!/bin/bash
# Usage notes:
# 1. Make sure that pandoc is installed.
# 2. Place all your contents for each chapter of your devlog into
# `./chap1/content.md`, `./chap2/content.md`, etc.
# 3. This script will source a file in each chapter called METAINFO.inc. This
# file is optional and can contain two variable declarations:
# AUTHOR="Name Of Author"
# DATE="Date or publication"
@lelanthran
lelanthran / pomodoro.sh
Last active September 13, 2022 06:40
basic pomodoro clock, requires wmctrl and zenity
#!/bin/bash
#
# vim: ts=3:sw=3:et
#
# Pomodoro - Basic Pomodoro Clock
# Copyright 2022 Lelanthran Manickum
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
@lelanthran
lelanthran / gitall.sh
Last active June 22, 2021 14:40
Work with many git subdirs.
#!/bin/bash
# Tool to run git on all of the sub-repos specified. Use all the standard
# git commands with this (status, branch, checkout, reset, etc) and each
# command will be run for all of the repos.
# Replace the following list of dirname=url with your own.
export URLS='
[email protected]:lelanthran/askme.git
[email protected]:lelanthran/cgui.git
(setq-default inhibit-startup-screen t)
(progn
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(when (fboundp 'horizontal-scroll-bar-mode)
(horizontal-scroll-bar-mode -1)))
@lelanthran
lelanthran / reformat.c
Last active December 24, 2020 10:21
C function to reformat textual content into paragraphs
/* gcc -ggdb -W -Wall -pedantic -o reformat.elf reformat.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include <stdbool.h>
/* ************************************************************************* *
// gcc -o run_inferior run_inferior.c -W -Wall
/* A function to execute a child program and feed the input line-by-line back
* to the calling program. The function mst be called with a callback function
* that will receive each line as it is read in, a program to execute and the
* command line arguments for that program.
*
* There are two versions of this function: one that takes the command line
* arguments as variadic parameters delimited with a NULL pointer and one that
* takes an array of parameters with a length specified for the array.