Skip to content

Instantly share code, notes, and snippets.

@brouhaha
brouhaha / gist:3ee9b853ba98558be084
Created October 31, 2014 22:55
bag_inventory.py
#!/usr/bin/python
# dailyprogrammer challenge #186 Bag Inventory
# Eric Smith <spacewar@gmail.com> 2014-10-31
import numpy as np, matplotlib.colors as mc, matplotlib.pyplot as plt
candy = {}
with open('186_easy.txt') as f:
for line in f.readlines():
line = line.strip()
if line in candy:
candy[line] += 1
@brouhaha
brouhaha / misaligned.c
Created December 6, 2014 03:02
Test misaligned reads and writes spanning cache line boundaries
// Test misaligned reads and writes spanning cache line boundaries
// 2014-12-05 Eric Smith <spacewar@gmail.com>
// This program demonstrates that on an AMD FX-8350, and presumably
// other x86_64 processors, misaligned 64-bit reads and/or writes
// which span a cache line boundary are not atomic. For a
// "simultaneous" write and read of a misaligned value, the read may
// return a value that is partially the pre-write value, and partially
// the written value.
-- Floppy disk read data pulse catcher
-- Eric Smith <spacewar@gmail.com>
-- 2016-08-02
-- WARNING: untested
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity floppy_rd_pulse_catcher is
@brouhaha
brouhaha / flashlight_if_vs_vf.pdf
Last active May 8, 2018 02:44
Measurement of LED performance of Harbor Freight single-LED three-AAA flashlight
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brouhaha
brouhaha / lll_basic.pdf
Last active May 21, 2018 21:18
LLL BASIC articles from Interface Age 1976-12 through 1977-03
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brouhaha
brouhaha / I-ADD-01.coe
Last active December 19, 2018 03:39
I-ADD-01.coe
memory_initialization_radix = 16;
memory_initialization_vector =
80,
68,
00,
0a,
00,
00,
00,
00,
@brouhaha
brouhaha / gist:ce5ec640ca1a7bd9213b6036fb04b436
Created August 20, 2021 09:57
two input glitch-free clock multiplexer for CPLD, in CUPL language, extracted from larger design
Name CLOCKSEL;
PartNo U11;
Revision 01;
Date 11/27/2015;
Designer Eric Smith;
Company none;
Assembly FDC;
Location U11;
Device v750c; /* ATF750CL */
@brouhaha
brouhaha / Keywords.py
Last active November 5, 2021 16:10
Keywords helper class for PyParsing
#!/usr/bin/env python3
#
# Copyright (c) 2021 Eric Smith
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to