Skip to content

Instantly share code, notes, and snippets.

@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 */
@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 / calc.c
Created August 29, 2011 19:48
shunting yard algorithm in c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define CHECKMALLOC(var) if((var) == NULL) {printf("ERROR: malloc\n");abort();}
#define MAXOPSTACK 64
#define MAXNUMSTACK 64
@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 pi@192.168.3.249:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@192.168.3.249 'sudo mv ~/archives/* /var/cache/apt/archives/'
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_setup pi@192.168.3.249:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@192.168.3.249 'bash ~/pi_setup pi9 109'
# for pi in 110 111 112
# do
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_keys pi@192.168.3.$pi:~/.ssh/authorized_keys
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_hosts pi_mpihostsfile pi@192.168.3.$pi:~/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp ~/.ssh/config pi@192.168.3.$pi:~/.ssh/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@192.168.3.$pi 'cat /etc/hosts pi_hosts | tee hosts ; sudo cp hosts /etc/hosts'
@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>
#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 / 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)
#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 / clock.ino
Created March 26, 2012 15:25
time.h testing
#include <Time.h>
#include <Wire.h>
#include <LibTemperature.h>
LibTemperature temp = LibTemperature(0);
//echo T$(($(date +%s)+60*60*-4)) > /dev/tty.usbserial-A4006DN3
#define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by unix time_t as ten ascii digits
#define TIME_HEADER 'T' // Header tag for serial time sync message