Skip to content

Instantly share code, notes, and snippets.

View netom's full-sized avatar

Fábián Tamás László netom

  • i-Cell Mobilsoft Zrt.
  • Budapest
View GitHub Profile
@netom
netom / get-bert.sh
Created October 4, 2021 12:07
Search through `dmesg` output, look for BERT related messages and try to save the BERT content as both .hex and binary files.
#!/bin/bash
NOW=$(date +%s)
HEXFNAME=bert-data-${NOW}.hex
BINFNAME=bert-data-${NOW}.bin
{ dmesg \
| grep '\[Hardware Error]: \+[0-9]' \
| sed -r '/.*/ {s/^.*\[Hardware Error]: +[0-9a-FA-F]{4}([0-9a-FA-F]{4}): (([0-9a-FA-F]{8} ){4}).*$/:10 \1 00 \2 00/;s/ //g}' \
; echo ':00000001FF'; \
@netom
netom / hello.asm
Created March 26, 2021 13:12
Tiny "Hello World" program for Linux (>=2.2)
; Credits: https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
; Compile: nasm -f bin -o hello hello.asm
BITS 32
org 0x08048000
ehdr: ; Elf32_Ehdr
db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident
times 8 db 0
dw 2 ; e_type
@netom
netom / install-atom-deps.sh
Created December 24, 2018 09:09
Install atom-haskell dependencies with stack
#!/bin/bash
cat > ~/.stack/global-project/stack.yaml <<END
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project. Settings here do _not_ act as
# defaults for all projects. To change stack's default settings, edit
# '/home/netom/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
let steering = 0
let led2 = 0
let distance = 0
bluetooth.onBluetoothConnected(() => {
basic.showLeds(`
. # # . .
. # . # .
. # # . .
. # . # .
. # # . .
let distance = 0
bluetooth.onBluetoothConnected(() => {
basic.showLeds(`
. # # . .
. # . # .
. # # . .
. # . # .
. # # . .
`)
})
@netom
netom / spectrum.py
Last active July 24, 2023 21:51
Simple spectrum analyzer in python using pyaudio and matplotlib
#!/usr/bin/env python
# -*- charset utf8 -*-
import pyaudio
import numpy
import math
import matplotlib.pyplot as plt
import matplotlib.animation
RATE = 44100
@netom
netom / trietest.py
Created January 20, 2016 21:30
Testing marisa-trie performance with 2 million filenames (in find.txt, file list is not included)
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
import marisa_trie
def uread(f):
for line in f:
yield line.decode('utf8', 'replace')
ds = []