Skip to content

Instantly share code, notes, and snippets.

View bkralik's full-sized avatar

bkralik bkralik

View GitHub Profile
@bkralik
bkralik / read_racelogic_ref.py
Last active April 3, 2025 12:40
Read Racelogic REF file
from loguru import logger
import zlib
filename = "Dodge-Charger-LD-2018.REF"
f = open(filename, "rb")
l = f.readline().decode("utf-8").rstrip()
logger.debug("First line read: {}", l)
@bkralik
bkralik / hella_oil_sensor.ino
Last active January 12, 2022 07:45
Arduino sketch to interface Hella OPS+T sensor
// HELLA OPS+T Combined digital sender (Oil pressure and temperature in one package)
// Usage: look at setup() and loop().
// Settings
const byte hella_pin = 2; // Pin to connect Hella OPS+T to (must be 2 or 3 on regular Arduino)
const byte hella_count = 16; // Number of time samples to capture - higher number for higher precision but lower refreshrate
// Variables
volatile uint32_t hella_measured[hella_count];
volatile uint8_t hella_num = 0;
7#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import ctypes
import resource
@bkralik
bkralik / afpacket.go
Last active March 20, 2020 07:53
af_packet capture
// Copyright 2018 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.
// afpacket provides a simple example of using afpacket with zero-copy to read
// packet data.
package main
@bkralik
bkralik / readme.md
Created January 18, 2019 10:18 — forked from tuxmartin/readme.md
Nahrazeni/pridani parametru u systemd sluzby

Priklad: chceme zmenit hodnotu Nice pro sluzbu zabbix-agent.service

Vychozi je /lib/systemd/system/zabbix-agent.service, na ten nesahame, protoze by nam ho prepsalo apt pri aktualizaci.

Vyvorime adresar a soubor s nastavenim:

mkdir -p /etc/systemd/system/zabbix-agent.service.d
touch /etc/systemd/system/zabbix-agent.service.d/10-custom-nice.conf

Syntaxe je JMENO.service.d, tedy zabbix-agent.service.d.

// ==UserScript==
// @name UserDB pinger
// @version 2
// @match http://userdb.hkfree.org/*
// @match https://userdb.hkfree.org/*
// @grant GM.xmlHttpRequest
// @run-at document-idle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
// ==UserScript==
// @name UserDB pinger
// @version 1
// @match http://userdb.hkfree.org/*
// @match https://userdb.hkfree.org/*
// @grant GM.xmlHttpRequest
// @run-at document-idle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
@bkralik
bkralik / RouterOSparseInterval.php
Last active November 25, 2015 23:11
Mikrotik RouterOS time interval parser
<?php
function RouterOSparseInterval($in) {
$pattern = "/(\d+)([wdhms])/";
$multipliers = array(
"w" => 604800,
"d" => 86400,
"h" => 3600,
"m" => 60,
"s" => 1
@bkralik
bkralik / capturev4l2.c
Last active November 19, 2017 08:15 — forked from jayrambhia/capturev4l2.c
Better capturing routine for v4l2 in openCV
#include <errno.h>
#include <fcntl.h>
#include <linux/videodev2.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <opencv2/core/core.hpp>