Skip to content

Instantly share code, notes, and snippets.

View AlexanderProd's full-sized avatar
⚛️
Looking at FLIR images.

Alexander Hörl AlexanderProd

⚛️
Looking at FLIR images.
View GitHub Profile
#!/bin/bash
set -euo pipefail
# Directory setup
APP_DIR="${HOME}/Applications"
ICON_DIR="${HOME}/.local/share/icons"
DESKTOP_DIR="${HOME}/.local/share/applications"
BIN_DIR="${HOME}/.local/bin"
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active November 14, 2024 20:42
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
@sohnryang
sohnryang / vivado-on-m1-mac.md
Last active November 15, 2024 19:27
Vivado on ARM64 Mac using Rosetta 2

Running Vivado on ARM64 Mac using Rosetta 2

macOS Ventura supports running x86-64 binaries on Linux VMs. However, even with Rosetta installing Vivado is not a simple one-click process. This guide covers some workarounds and tricks to get Vivado up and running on ARM64 Mac.

  1. Make sure you're running macOS Ventura or higher.
  2. Install UTM and create a Debian VM with Rosetta according to their guide.
    • Other distributions should also work, but commands will be different.
  3. Install x86-64 version of java and libtinfo. Vivado depends on them.
@idleberg
idleberg / vscode-macos-context-menu.md
Last active November 13, 2024 10:38
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
import (
"fmt"
"io/fs"
"path/filepath"
)
// example of counting all files in a root directory
func countFiles() int {
count := 0;
filepath.WalkDir(".", func(path string, file fs.DirEntry, err error) error {
@ccnokes
ccnokes / heic_to_jpeg.sh
Last active September 24, 2024 19:49
Bash script that converts .HEIC to .jpg files
#!/bin/bash
set -eu -o pipefail
count=$(find . -depth 1 -name "*.HEIC" | wc -l | sed 's/[[:space:]]*//')
echo "converting $count files .HEIC files to .jpg"
magick mogrify -monitor -format jpg *.HEIC
echo "Remove .HEIC files? [y/n]"
@kmhofmann
kmhofmann / installing_nvidia_driver_cuda_cudnn_linux.md
Last active October 13, 2024 14:55
Installing the NVIDIA driver, CUDA and cuDNN on Linux

Installing the NVIDIA driver, CUDA and cuDNN on Linux (Ubuntu 20.04)

This is a companion piece to my instructions on building TensorFlow from source. In particular, the aim is to install the following pieces of software

on an Ubuntu Linux system, in particular Ubuntu 20.04.

@Retsam
Retsam / exampleState.ts
Last active January 31, 2021 18:11
Redux-like useReducer pattern
import { Dispatch, useReducer, useEffect } from "react";
import { produce } from "immer";
//=======
// State
//=======
export type ExampleState = {
name: string;
level: number;
saved: false;
@FlorianRappl
FlorianRappl / useCarousel.ts
Last active August 16, 2024 06:30
The generic useCarousel hook.
import { useReducer, useEffect } from 'react';
import { useSwipeable, SwipeableHandlers, EventData } from 'react-swipeable';
function previous(length: number, current: number) {
return (current - 1 + length) % length;
}
function next(length: number, current: number) {
return (current + 1) % length;
}