Skip to content

Instantly share code, notes, and snippets.

View flatcap's full-sized avatar

Richard Russon flatcap

View GitHub Profile
@flatcap
flatcap / log.sh
Last active September 25, 2015 13:11
BeniBela's log of active windows
#!/bin/bash
# while sleep 60; do info=$(xwininfo -all -id "$(xprop -root|sed -n '/ACTIVE_WINDOW(/s/.*#//p')");echo $(date +"%F %T"): $(ps h -o %a $(awk '/Process id:/{print $3}'<<<"$info")) \"$(awk -F\" '/"/{print $2}'<<<"$info")\";done>>logfile
while sleep 60; do
info=$(xwininfo -all -id "$(xprop -root | sed -n '/ACTIVE_WINDOW(/s/.*#//p')")
echo $(date +"%F %T"): $(ps h -o %a $(awk '/Process id:/{print $3}' <<< "$info")) \"$(awk -F\" '/"/{print $2}' <<< "$info")\"
done >> logfile
@flatcap
flatcap / idletime.c
Created September 25, 2015 12:59
How long, in seconds, has XWindows been idle
// gcc -Wall idletime.c -o idletime -L/usr/X11R6/lib/ -lX11 -lXext -lXss
#include <stdio.h>
#include <X11/extensions/scrnsaver.h>
int main()
{
XScreenSaverInfo *info = XScreenSaverAllocInfo();
Display *display = XOpenDisplay (NULL);
if (display == NULL) {
# A wrapper around ssh to automatically provide logging and session handling.
# This function runs ssh, which runs screen, which runs script.
# Requirements:
# * Log sessions on a remote server
# * Transparent - nothing extra to type
# * No installation - nothing to copy to the server beforehand
# Features:
# * Function wrapper delegating to ssh
@flatcap
flatcap / date.sh
Created May 20, 2016 13:17
Conditional Dates Generator
#!/bin/bash
TEST_LIST=()
FORMAT_LIST=()
IFS=""
while :; do
read -p "Test: " TEST
[ -z "$TEST" ] && break;
@flatcap
flatcap / mailbox.rc
Last active August 5, 2016 14:17
Indented mailboxes in NeoMutt
mailboxes "=mutt"
mailboxes "=mutt.arch"
mailboxes "=mutt.debian"
mailboxes "=mutt.dev"
mailboxes "=mutt.kz"
mailboxes "=mutt.neo"
mailboxes "=mutt.suse"
mailboxes "=mutt.travis"
mailboxes "=mutt.users"
@flatcap
flatcap / crypto.rc
Last active January 20, 2024 19:04
Mutt config for crypto
# Common Crypto Options
set crypt_auto_encrypt = no # Automatically encrypt all mail
set crypt_auto_pgp = yes # Allow automatic pgp functions
set crypt_auto_sign = no # Automatically sign all mail
set crypt_auto_smime = yes # Allow automatic smime functions
set crypt_confirm_hook = yes
set crypt_opportunistic_encrypt = no
set crypt_reply_encrypt = yes
set crypt_reply_sign = yes
set crypt_reply_sign_encrypted = yes
@flatcap
flatcap / doc-gen.sh
Last active August 11, 2016 10:51
Generate the neomutt docs
#!/bin/bash
eval REPO="${1:-~/neo-docs}"
cp "$REPO"/doc/chunk.xsl .
cp "$REPO"/doc/manual.xml .
cp "$REPO"/doc/mutt.css .
cp "$REPO"/doc/mutt.xsl .
# The devel features are not merged into neomutt, so insert them now
@flatcap
flatcap / mutt-edit.sh
Created August 27, 2016 13:21
Mutt spawn editor
#!/bin/sh
gedit "$1" &
sleep 2
exit 0

Keybase proof

I hereby claim:

  • I am flatcap on github.
  • I am flatcap (https://keybase.io/flatcap) on keybase.
  • I have a public key whose fingerprint is 69AD 1D63 6AC2 92E8 2065 8C16 EBC1 50E4 B5DA 63DF

To claim this, I am signing this object:

@flatcap
flatcap / v4.md
Last active November 13, 2016 12:35
Fedora Berkeley DB devel installs

Version 4

Lib

  • libdb4-4.8.30-20.fc24.x86_64.rpm
-rwxr-xr-x 1 root root 1605872 Feb  4  2016 /usr/lib64/libdb-4.8.so
lrwxrwxrwx 1 root root      12 Feb  4  2016 /usr/lib64/libdb-4.so -> libdb-4.8.so