Skip to content

Instantly share code, notes, and snippets.

@madmo
madmo / nand_interface.v
Created December 13, 2015 19:02
simple verilog 8-Bit Nand interface (avalon compatible)
module bidir_driver #(parameter width=8) (data_rw, data_r, data_w, oe);
inout wire [width-1:0] data_rw;
input wire [width-1:0] data_w;
output wire [width-1:0] data_r;
input wire oe;
assign data_rw = oe ? data_w : { width {1'bZ} };
assign data_r = data_rw;
endmodule
@madmo
madmo / fwd.go
Last active December 20, 2015 09:29
Simple tcp forwarding daemon
// Copyright (c) 2013, Moritz Bitsch <moritzbitsch@googlemail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@madmo
madmo / gist:7403249
Created November 10, 2013 20:09
Minimal nand controller ip core in myhdl (untested)
from myhdl import *
FPGA_NAND_CMD_MASK = (0x7 << 28)
FPGA_NAND_CMD_COMMAND = (0x0 << 28)
FPGA_NAND_CMD_ADDR = (0x1 << 28)
FPGA_NAND_CMD_READ = (0x2 << 28)
FPGA_NAND_CMD_WRITE = (0x3 << 28)
FPGA_NAND_BUSY = (0x1 << 15)
FPGA_NAND_ENABLE = (0x1 << 31)
FPGA_NAND_DATA_SHIFT = 16
@madmo
madmo / fanotify.go
Created June 28, 2012 11:34
GO fanotify api
// Copyright (c) 2012, Moritz Bitsch <moritzbitsch@googlemail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES

Keybase proof

I hereby claim:

  • I am madmo on github.
  • I am moritzbitsch (https://keybase.io/moritzbitsch) on keybase.
  • I have a public key whose fingerprint is 9D7C D293 4B21 D0C5 ABA7 BA6C 0ED4 B6A9 67C3 4B54

To claim this, I am signing this object:

@madmo
madmo / pass2csv.sh
Created April 13, 2018 18:56
pass to keepass xc csv exporter
#!/bin/bash
# export passwords to external file
shopt -s nullglob globstar
prefix=${PASSWORD_STORE_DIR:-$HOME/.password-store}
for file in "$prefix"/**/*.gpg; do
file="${file/$prefix//}"
GROUP=$(dirname "$file" | sed 's#^//##')
@madmo
madmo / build-mspgcc.sh
Created August 30, 2012 23:15
OSX msp430 toolchain install script
#!/bin/bash
# Based on the script found here: http://xpg.dk/projects/msp430/msp430-gcc-uniarch-build-script/
# brew install gmp mpfr libmpc
set -e
function gitUpdate()
{
SRC_ROOT=$1
@madmo
madmo / Tronxy X3S Fast.fff
Created January 10, 2018 18:35
Tronxy X3S Simplify3d
<?xml version="1.0"?>
<profile name="Tronxy X3S Fast" version="2018-01-08 20:51:17" app="S3D-Software 4.0.1">
<baseProfile>Default</baseProfile>
<printMaterial>PLA</printMaterial>
<printQuality>High</printQuality>
<printExtruders></printExtruders>
<extruder name="Primary Extruder">
<toolheadNumber>0</toolheadNumber>
<diameter>0.4</diameter>
<autoWidth>0</autoWidth>
@madmo
madmo / init.el
Created June 29, 2021 08:51
emacs config
(require 'cl-lib)
(require 'package)
;; add melpa as package source
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; list of packages to install
(defvar my-packages
'(smart-tabs-mode smart-tab company flycheck lsp-mode lsp-ui rustic)
@madmo
madmo / onair-sign.py
Created August 31, 2021 05:37
Simple webcam on/off script used to control a onair sign with tasmota firmware
#!/usr/bin/python
import pyinotify
import asyncio
import aiohttp
import sys
def debounce(wait):
def decorator(fn):
def debounced(*args, **kwargs):