Skip to content

Instantly share code, notes, and snippets.

#include <Wire.h>
#include "Adafruit_MCP23017.h"
Adafruit_MCP23017 mcp;
#define NUM_ROWS 5
#define NUM_COLS 10
uint32_t hold_time[NUM_ROWS][NUM_COLS];
@AnthonyDiGirolamo
AnthonyDiGirolamo / .Xresources
Created August 27, 2016 04:00
Xresources example
! Font options - ~/.fonts.conf seems to override this
! Resolution for Xft in dots per inch (e.g. 96)
!Xft.dpi: 128
! Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
!Xft.rgba: rgba
!Xft.antialias: 1
!Xft.hinting: 1
!Xft.autohint: 0
! What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull)
!Xft.hintstyle: hintslight
@AnthonyDiGirolamo
AnthonyDiGirolamo / vimfx-hints.css
Created August 31, 2015 18:07
vimfx-hints.css
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix(http://), url-prefix(https://), url-prefix(ftp://), url-prefix(file://) {
/* AGENT_SHEET */
.VimFxHintMarker { position: absolute !important; display: block !important; top: -1px; left: -1px; white-space: nowrap !important; overflow: hidden !important; font-size: 11px !important; padding: 2px 3px !important; background-color: #feda31 !important; border: 0 !important; border-radius: 2px !important; box-shadow: inset 0 -2px 0 #b39922 !important;
}
.VimFxHintMarker span { color: #4a400e !important; font-family: Helvetica, Arial, sans-serif !important; font-weight: bold !important; font-size: 16px !important;
}
.VimFxHintMarker > .VimFxCharMatch { color: #dcbc2a !important; }
@AnthonyDiGirolamo
AnthonyDiGirolamo / kanboard.user.js
Last active August 29, 2015 14:19
kanboard greasemonkey tweaks
// ==UserScript==
// @name kanboard
// @namespace https://kanboard.ccs.ornl.gov/
// @include https://kanboard.ccs.ornl.gov/*
// @version 1
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
@AnthonyDiGirolamo
AnthonyDiGirolamo / py_read_file.py
Last active December 16, 2019 09:11
How to read a file in python line by line. This method incrementally loads the file.
#!/usr/bin/env python
#import pprint
#pp = pprint.PrettyPrinter(indent=4, width=110).pprint
with open('all_messages.log') as f:
for i, line in enumerate(f):
print("{0}:".format(i), end='')
print(line)
@AnthonyDiGirolamo
AnthonyDiGirolamo / rgb_cpu_usage.c
Last active December 15, 2020 08:48
RGB LED CPU usage on a Raspberry Pi
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <signal.h>
@AnthonyDiGirolamo
AnthonyDiGirolamo / pi_setup.sh
Last active September 15, 2021 02:02
Raspberry Pi Provisioning Script
#!/usr/bin/env bash
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp -r archives [email protected]:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected] 'sudo mv ~/archives/* /var/cache/apt/archives/'
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_setup [email protected]:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected] 'bash ~/pi_setup pi9 109'
# for pi in 110 111 112
# do
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_keys [email protected].$pi:~/.ssh/authorized_keys
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_hosts pi_mpihostsfile [email protected].$pi:~/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp ~/.ssh/config [email protected].$pi:~/.ssh/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected].$pi 'cat /etc/hosts pi_hosts | tee hosts ; sudo cp hosts /etc/hosts'
#include <stdio.h>
#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d"
#define BYTETOBINARY(byte) \
(byte & 0x80 ? 1 : 0), \
(byte & 0x40 ? 1 : 0), \
(byte & 0x20 ? 1 : 0), \
(byte & 0x10 ? 1 : 0), \
(byte & 0x08 ? 1 : 0), \
(byte & 0x04 ? 1 : 0), \
@AnthonyDiGirolamo
AnthonyDiGirolamo / userChrome.css
Created July 22, 2013 16:59
postbox userChrome cusomizations
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Set Font Size In Folder Pane */
#folderTree >treechildren::-moz-tree-cell-text {
/*font-family: Lucida Sans !important;*/
font-size: 12pt !important; }
#folderTree treechildren::-moz-tree-row {
height: 32px !important; }
@AnthonyDiGirolamo
AnthonyDiGirolamo / userChrome.css
Last active June 4, 2023 19:40
thunderbird custom style for message and folder pane list
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Set Font Size In Folder Pane */
#folderTree >treechildren::-moz-tree-cell-text {
/*font-family: Lucida Sans !important;*/
font-size: 12pt !important; }
/* Set Font Size In Thread Pane */