Skip to content

Instantly share code, notes, and snippets.

Take note of how the SD card is identified.
In my case it is /dev/sdb1.
Then:
sudo dd bs=4M if=/dev/mmcblk0 status=progress | gzip > /home/your_username/image`date +%d%m%y`.gz
This will compress the image using gzip.
To restore the backup on SD card:
sudo gzip -dc /home/your_username/image.gz | dd bs=4M status=progress of=/dev/mmcblk0
@DavidM42
DavidM42 / build.yaml
Last active June 21, 2021 19:48
Decker github action build and deploy to github pages script. Builds html version of decker presentation and pushes it to gh pages
name: CI and gh-Pages deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
@DavidM42
DavidM42 / setup.md
Last active May 15, 2021 19:51
Unity with vscode for script and debugging setup in Ubuntu 20.04

VScode setup

  1. Install .NET sdk
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

then

sudo apt-get update; \
@DavidM42
DavidM42 / HowTo.md
Created December 31, 2020 00:15
CSS Content Addon in Gmod for Dummies

CSS Content Addon in Gmod for Dummies

  1. Download the zipped addon from mega
  2. Open your file explorer to the Garry's Mod Game in your steam directory
  • Similiar to C:\SteamBib\steamapps\common\GarrysMod\garrysmod\addons
  1. Unzip content of Downloaded zip to this folder
@DavidM42
DavidM42 / remap.py
Created October 30, 2020 23:53
Remap Individual Billard Ball PascalVOC Labels into teams
import os
from enum import Enum
# this script takes in a folder containing pictures of billard tables
# labelled with all balls individually in pascalVOC format
# and depending on the config value remaps the labels of balls to their teams value
# you can start it in your terminal and enter the required info in there
# set your folder containing dataset here
# empty "" for folder in which script is
@DavidM42
DavidM42 / opencv_twitch.py
Last active October 30, 2020 22:20 — forked from kscottz/opencv_twitch.py
A hack to slurp up twitch streams and process them with opencv.
# this fork
# * updates the original script with the new fork of livestreamer
# - now uses streamlink library
# * makes it ready for python3 by updating the print statements
import cv2
import numpy as np
import time
import streamlink
@DavidM42
DavidM42 / alexaAudioRecordingGetter.js
Created October 11, 2020 01:54
cycle alexa audio recording to play all on current page at least once
function loop(i) {
// timeout because only one can be playing at a time
setTimeout(() => {
document.querySelectorAll('.d-playback-icon')[i].click();
loop(i+1);
}, 4000);
}
loop(0);
@DavidM42
DavidM42 / checkerBoardBlackTileSort.ts
Created April 30, 2020 14:31
How to checherboard pixels for webgl use
/**
* Checkerboard has 8*8 tiles starts with black at top left
* @param x X coordinate of pixel to check
* @param y Y coordinate of pixel to check
* @param width Width of canvas
* @param height Height of canvas
*/
const isBlackTile = (x: number, y: number, width: number, height: number) => {
const boxPixelWidth = width / 8;
const boxPixelHeight = height / 8;
@DavidM42
DavidM42 / holy_layout.sh
Created January 16, 2020 01:36
X11 Layout Configuration for Yoga S740 with external 1080p DP monitor via usb-c adapter, hard work
#!/bin/sh
xrandr --dpi 314.7 \
--output eDP-1 --mode 3840x2160 --pos 0x1696 \
--output DP-2 --fb 7680x6016 --scale 2x2 --pos 3840x0
# dpi calculated as ppi via https://www.sven.de/dpi/
# I upscale external display to 4k via scale 2x2 instead of internal down
# pos 0x750 is cause external display is higher up
# fb is frame buffer which decides what is covered so has to be set for nothing to be black screen
# calucated via --> --fb 3840+2×1920 X 2160+6016+2×1080 # small number is position offset and x2 for 1080p is cause of 2x2 upscale
@DavidM42
DavidM42 / .bashrc
Created January 14, 2020 21:38
All in One monitoring command for linux Laptops
## APPEND THESE 2 lines TO EXISTING File
# monitor status of my computer
alias status="~/status.sh"