Skip to content

Instantly share code, notes, and snippets.

Avatar

Moritz Bitsch madmo

  • PTW Freiburg GmbH
  • Deutschland
View GitHub Profile
@madmo
madmo / init.el
Created Jun 29, 2021
emacs config
View init.el
(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 / pass2csv.sh
Created Apr 13, 2018
pass to keepass xc csv exporter
View pass2csv.sh
#!/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 / Tronxy X3S Fast.fff
Created Jan 10, 2018
Tronxy X3S Simplify3d
View Tronxy X3S Fast.fff
<?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>
View keybase.md

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 / nand_interface.v
Created Dec 13, 2015
simple verilog 8-Bit Nand interface (avalon compatible)
View nand_interface.v
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
View cheryls.ml
(*
* Copyright (c) 2015 Moritz Bitsch <moritzbitsch@gmail.com>
*
* Permission to use, copy, modify, and 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
@madmo
madmo / gist:8a599ca6385947f11e21
Created Dec 13, 2014
convert pic32 hex file from virtual to physical addresses
View gist:8a599ca6385947f11e21
lines = File.readlines(ARGV[0])
lines.map! do |line|
line = line.chomp
if line.length > 8 and line[7..8] == "04" then
addr = line[9..12].to_i(16)
addr &= 0x1fff
line[9..12] = addr.to_s(16).upcase.rjust(4, "0")
line[13..14] = (((~line[1..-3].scan(/../).inject(0) {|sum, s| sum + s.to_i(16) }) & 0xFF) + 1).to_s(16).upcase
end
@madmo
madmo / build-pic32-gcc.sh
Created Oct 20, 2014
gcc toolchain cretion script for pic32
View build-pic32-gcc.sh
#!/bin/bash
set -e
#
# Path definitions
#
TOOLCHAIN_ROOT_DIR="${PWD}/$(dirname $0)"
TOOLCHAIN_DL_DIR="${TOOLCHAIN_ROOT_DIR}/dl"
TOOLCHAIN_OUT_DIR="${TOOLCHAIN_ROOT_DIR}/output"
@madmo
madmo / lexer.ml
Created Sep 9, 2014
Lexing c-comments using camlp4
View lexer.ml
type token =
| Text of char
| Comment of string
let rec lex = parser
| [< ''/'; p = parser (* left factoring... *)
| [< ''/'; stream >] ->
let buffer = Buffer.create 1 in
lex_comment buffer stream
| [< ''*'; stream >] ->
@madmo
madmo / nums.ml
Created Aug 6, 2014
Converting numbers in ocaml, the lazy way
View nums.ml
open Core.Std;;
let read_and_convert =
let rec aux line =
match line with
| None -> () (* EOF *)
| Some txt ->
try print_endline (Int.to_string (Int.of_string txt)); with
Failure detail -> print_endline detail; ; (* End of try/with*)
aux (In_channel.input_line In_channel.stdin)