Skip to content

Instantly share code, notes, and snippets.

View flatcap's full-sized avatar

Richard Russon flatcap

View GitHub Profile
@flatcap
flatcap / test_parse_date.c
Created April 4, 2023 18:48
stub to test mutt_date_parse_date()
#include <stdio.h>
#include "mutt/lib.h"
int main(int argc, char *argv[])
{
if (argc != 2)
return 1;
FILE *fp = fopen(argv[1], "r");
if (!fp)
@flatcap
flatcap / calc.sh
Created April 2, 2023 11:56
check for missing doxygen function headers
#!/bin/bash
set -e
function files()
{
find . \( -name .git -o -name queue.h -o -name 'pgpewrap.c' -o -path './debug/*' -o -path './test/*' -o -path './autosetup/*' -o -path './docs/*' \) -prune -o -type f -name '*.[ch]' -print0 | sed -z 's/^\.\///' | sort --zero-terminated
}
[ $# = 1 ] && DIR="${1%/}" || DIR=""
@flatcap
flatcap / pvr.md
Created March 6, 2023 14:15
Patterns vs Regexes

Patterns vs Regexes

$default_hook

Default: "~f %s !~P | (~P ~C %s)"

Applies to hooks:

  • fcc-hook
  • fcc-save-hook
# Patch syntax highlighting
# color normal white default
# Diff changes
color body brightgreen default "^[+].*"
color body brightred default "^[-].*"
# Diff file
color body green default "^[-][-][-] .*"
@flatcap
flatcap / mouse.php
Created May 30, 2022 10:33
mouse php dump events
#!/usr/bin/php
<?php
system("stty -icanon"); // Enable shell input
system("stty -echo"); // Disable characters printing
echo "\e[?1003h\e[?1015h\e[?1006h"; // Mouse trap all, urxvt, SGR1006
function shutdown(){ // Cleaning before quiting
echo "\e[?1000l"; // Disable mouse trap
system("stty echo"); // Enable back characters printing
exit; // Cleaned, quit
@flatcap
flatcap / mouse.c
Created May 30, 2022 10:33
mouse ncurses dump events
// gcc -o mouse mouse.c -lncursesw
#include <assert.h>
#include <ncurses.h>
#include <string.h>
WINDOW *create_newwin(int height, int width, int starty, int startx)
{
WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
@flatcap
flatcap / gmail.rc
Last active January 20, 2024 19:12
neomutt config gmail
# To use: change gmail's settings to:
# enable imap:
# Gmail Settings
# Forwarding and POP/IMAP
# create an app password
# App passwords
# https://myaccount.google.com/security
set imap_login = ""
set imap_pass = "XXXXXXXXXXXXXXXX"
@flatcap
flatcap / email.svg
Last active January 6, 2022 01:38
Body logging
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@flatcap
flatcap / nl.c
Created December 29, 2021 13:54
translations for yes
#include <stdio.h>
#include <langinfo.h>
#include <locale.h>
int main(int argc, char *argv[])
{
setlocale(LC_ALL, "");
char *expr = nl_langinfo(YESEXPR);
if (expr)
printf("%s\n", expr);
@flatcap
flatcap / main.rc
Created September 1, 2021 10:52
neomutt: toggle limit to tagged emails
macro index <F5> "<enter-command> source on.rc<enter>"