Skip to content

Instantly share code, notes, and snippets.

@Excedrin
Excedrin / gmail-header-filter.gs
Last active July 16, 2026 00:01
Filter gmail messages using app script based on mail headers
// To deploy: paste into a new project at script.google.com, adjust the RULES, run
// installTrigger() once, and approve the Gmail OAuth prompt.
// ==== Debug ====
// Logs go to the Executions view (left sidebar in the Apps Script editor).
var DEBUG_LOG = false; // note: JS lowercase false, not False
// ==== Rules ====
// header -> value regex -> list of actions.
// Regexes are unanchored (use ^...$ to match the whole value) and
@Excedrin
Excedrin / onoayo-ay2pro-remote-codes.txt
Created June 3, 2026 20:56
Onoayo AY2Pro NEC remote codes
NEC remote codes for Onoayo AY2Pro projector.
807f 00ff power
807f 22dd mute
807f 906f source
807f a05f up
807f 40bf left
807f 609f OK
807f 50af right
807f 20df down
@Excedrin
Excedrin / gist:91cf98f60f66bf46fcdc4b3834793fb9
Created October 7, 2024 18:54
sway better image capture, with cursors and mouse over by first capturing all outputs, then displaying each captured image on each output and using slurp and grim to select and capture from these "overlay" images. Requires: sway, grim, jq, swayimg, slurp.
#!/usr/bin/env bash
# Create a temporary directory for screenshots
tmpdir=$(mktemp -d)
# Get the list of active outputs
outputs=$(swaymsg -t get_outputs | jq -r '.[] | select(.active) | .name')
initial_focus=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
def selfdec(f):
def dec(*x, **kwa):
f.__globals__['self'] = x[0]
return f(*x[1:], **kwa)
return dec
class X():
@selfdec
def z(more, args, even="opt"):
self.hurr = 3
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Virt management features
Copyright 2007, 2012 Red Hat, Inc
Michael DeHaan <michael.dehaan@gmail.com>
Seth Vidal <skvidal@fedoraproject.org>
@Excedrin
Excedrin / bind.py
Last active December 21, 2015 01:59
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/bin/bash
set -e
VERSION=$1
INSTALLER="OCTGN-Setup-${VERSION}.exe"
echo $VERSION $INSTALLER
@Excedrin
Excedrin / gist:3612698
Created September 3, 2012 19:33
imperative foldl and foldr
#!/usr/bin/rdmd
import std.stdio;
int sub(int x, int y) {
return x - y;
}
void main() {
int init = 0;
@Excedrin
Excedrin / forkeval
Created August 27, 2012 08:24
2007 python multiprocessing
import os
def evalexit(code):
eval(code)
raise SystemExit
def forkexpr(s):
code = compile(s, "<string>", "eval")
os.fork() or evalexit(code)
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#define CHAR_BIT 8
#define MAXBITS (CHAR_BIT*sizeof(uintmax_t))
#define FMT_BUF_SIZE (MAXBITS+1)
char *binary_fmt(uintmax_t x, char buf[static FMT_BUF_SIZE])
{