Skip to content

Instantly share code, notes, and snippets.

View vondraussen's full-sized avatar

Andy Hempel vondraussen

View GitHub Profile
@vondraussen
vondraussen / readme.md
Last active November 12, 2019 04:00
simple tcpdump traffic size analysis

capture traffic to specific host over specific time

timeout 10h tcpdump -n -e host 127.0.0.1 -w /tmp/traffic_10h.log

get cumulated size from all traffic - tcpdump version 4.9.2

tcpdump -e -n -r /tmp/traffic_10h.log tcp | sed -r -E -n "s/(^.*, length) ([0-9]{1,4}):(.*)/\2/p" | awk '{sum+=$1; print sum}' | numfmt --to=iec-i --suffix=B --padding=7
@vondraussen
vondraussen / Add a Cross Compiled Kernel Module (Raspberry Pi).md
Last active September 19, 2024 11:55
Add a Cross Compiled Kernel Module (Raspberry Pi)

Add a Cross Compiled Kernel Module (Raspberry Pi)

I made the following notes while I was compiling a Kernel module (SI7020 Humidity/Temp Sensor) for the Raspberry Pi. The module was not part of the precompiled modules shipped with Raspbian. The steps should be the same if you want to build a different module.

I didn't want to install the Kernel headers or build modules on the Raspberry Pi.

Keep in mind, that a new module has to be build and installed once you update the Kernel!

Get Installed Kernel Version

Get the Kernel Version Tag

apt search raspberrypi-kernel
# raspberrypi-kernel/stable,now 1.20190819~stretch-1 armhf [installed]

I'm using a 32.768 kHz Quarz to drive the async counter. This should work with the WDT as well.

void _pwrsave_sleep_asyn(uint16_t time) {
  uint16_t sleepCnt = time/8;

  cli();
  // switch timer2 to asynchronously mode
  // Disable the Timer/Counter2 interrupts by clearing OCIE2x and TOIE2
  TIMSK2 = 0;
  // Select clock source by setting AS2 as appropriate
@vondraussen
vondraussen / README.md
Last active December 21, 2020 16:02
Google Cloud Engine simple setup

Setup

cd ~
curl -Ls https://gist.github.com/raw/32c5c7be014ed26039a864f077dbff6f/setup.sh | bash

Logout and in again to apply the changed groups!

@vondraussen
vondraussen / nvidia-check-driver.sh
Created January 19, 2021 15:54
bash script to check installed and available (online) nvidia driver. it can download the latest as well. I use it if I end up with a black screen after Kernel update.
#!/bin/bash
# Installed Version
# modinfo nvidia | grep 'version:'
INSTALLED=`modinfo nvidia | grep '^version' | sed -r 's/version:.*([0-9]{3}\.[0-9]{2})/\1/'`
# Latest Long Lived Branch Version
AVAILABLE=`curl -s https://www.nvidia.com/en-us/drivers/unix/ | tr -d [:blank:] | \
grep -A 2 'Linuxx86_64/AMD64/EM64T' | \
grep 'LatestProductionBranchVersion' | \
@vondraussen
vondraussen / ssh_https_tunnel.md
Last active October 28, 2024 09:08
SSH through HTTPS tunnel via Openssl and Traefik

How to setup ssh through https tunnel

... via OpenSSL and Traefik

A HTTPS tunnel for SSH (Secure Shell) is a useful tool for accessing a remote server in a secure manner when the connection is limited or restricted by a firewall or network security measures. It provides a secure way to bypass these restrictions and access the remote server securely over the internet. The HTTPS protocol, which is used to secure web traffic, is utilized to create a secure connection to the remote server. The data transmitted over this connection is

@vondraussen
vondraussen / cr2toheic.sh
Created December 20, 2023 09:36
Canon CR2 RAW File to HEIC Conversion
#!/bin/bash
: '
Description: Canon CR2 to HEIC Converter
This Bash script automates the process of converting Canon CR2 raw image files to High-Efficiency Image Format (HEIC) files with a 16-bit color depth. The conversion is achieved using `dcraw` for raw file processing, preserving the intricate details captured by Canon cameras. Additionally, `exiftool` is employed to extract and retain Exif metadata, ensuring valuable information about the images is maintained.
Features:
- Converts Canon CR2 raw files to HEIC format.
- Utilizes `dcraw` for high-quality raw file conversion.