Skip to content

Instantly share code, notes, and snippets.

View Lauszus's full-sized avatar

Kristian Sloth Lauszus Lauszus

View GitHub Profile
@Lauszus
Lauszus / gh-dl-release
Created June 6, 2019 18:53 — forked from maxim/gh-dl-release
Download assets from private Github releases
#!/bin/bash -e
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@Lauszus
Lauszus / crc.py
Last active March 9, 2024 02:50
Generic CRC-8, CRC-16 and CRC-32 calculations in Python
#!/usr/bin/env python
# Inspired by: https://www.youtube.com/watch?v=izG7qT0EpBw
# The CRC values are verified using: https://crccalc.com/
def reflect_data(x, width):
# See: https://stackoverflow.com/a/20918545
if width == 8:
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1)
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2)
x = ((x & 0x0F) << 4) | ((x & 0xF0) >> 4)
@Lauszus
Lauszus / GPS.py
Created February 21, 2019 10:31
GPS NMEA string generator
#!/usr/bin/env python
import numpy as np
def main():
def ubx_checksum(data):
ck_a = 0
ck_b = 0
for byte in data:
@Lauszus
Lauszus / task.h
Last active November 30, 2023 11:32
FreeRTOS get stack size
/**
* task.h
* <PRE>UBaseType_t uxTaskGetStackSize( TaskHandle_t xTask );</PRE>
*
* Returns the stack size associated with xTask. That is, the stack
* size (in words, so on a 32 bit machine a value of 1 means 4 bytes) of the task.
*
* @param xTask Handle of the task associated with the stack to be checked.
* Set xTask to NULL to check the stack of the calling task.
*
@Lauszus
Lauszus / polyfit.py
Last active August 17, 2018 08:36
Modified PX4 polyfit class to use Eigen instead of PX4 Matrix library and added Python version
#!/usr/bin/python
# /****************************************************************************
# *
# * Copyright (c) 2015-2016 PX4 Development Team. All rights reserved.
# *
# * Redistribution and use in source and binary forms, with or without
# * modification, are permitted provided that the following conditions
# * are met:
# *
# * 1. Redistributions of source code must retain the above copyright
@Lauszus
Lauszus / README.md
Last active November 4, 2022 20:05
VESC 6 flash bootloader using ST-LINK/V2

Pinout

ST-LINK/V2 VESC
VAPP (pin 1) VCC
TCK_SWCLK (pin 9) CLK
GND (pin 20) GND
TMS_SWDIO (pin 7) IO
NRST (pin 15) RST
@Lauszus
Lauszus / install-8192eu.sh
Created April 7, 2018 18:31
Script for installing 8192eu kernel module on a Raspberry Pi
#!/bin/bash -e
kernel=$(uname -r | tr -d '+')
build=${build:-$(uname -v | awk '{print $1}' | tr -d '#')}
tarfile=8192eu-$kernel-$build.tar.gz
wget http://downloads.fars-robotics.net/wifi-drivers/8192eu-drivers/$tarfile
tar xzf $tarfile
./install.sh
@Lauszus
Lauszus / ap_config.sh
Created April 7, 2018 16:16 — forked from totti2/ap_config.sh
Adding accesspoint-mode to SSRPARI's stretch-branch (found here: https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md)
#!/bin/bash
if [ "$WIFIPASS" == "" ]
then
read -p "Wifi Interface: " WLAN # wlan0, wlan1 etc
read -p "Wifi Network name: " APName
read -p "Wifi Password: " WIFIPASS
fi
if [ -z "$exc" ]
then
source functions.sh
@Lauszus
Lauszus / script.sh
Created March 10, 2018 21:31
Automount bootcamp as needed for VirtualBox
#!/bin/bash -e
diskutil list
read -p $'This script will unmount "/Volumes/BOOTCAMP" and set the permission for the EFI (/dev/disk0s1) and BOOTCAMP (/dev/disk0s3) permissions to executable\nPress enter to continue'
diskutil unmount /Volumes/BOOTCAMP
sudo chmod 777 /dev/disk0s1
sudo chmod 777 /dev/disk0s3
@Lauszus
Lauszus / install-8192eu.sh
Created February 1, 2018 13:12
Small script for downloading and installing the drivers for the Realtek RTL8192EU WiFi adapter from http://fars-robotics.net
#!/bin/bash -e
kernel=$(uname -r | tr -d '+')
build=${build:-$(uname -v | awk '{print $1}' | tr -d '#')}
tarfile=8192eu-$kernel-$build.tar.gz
wget http://fars-robotics.net/$tarfile
tar xzf $tarfile
./install.sh