Skip to content

Instantly share code, notes, and snippets.

View AlexanderProd's full-sized avatar
⚛️
Fusing Hydrogen

Alexander Hörl AlexanderProd

⚛️
Fusing Hydrogen
View GitHub Profile
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active July 18, 2024 16:11
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
#
@idleberg
idleberg / vscode-macos-context-menu.md
Last active July 13, 2024 18:11
“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 July 4, 2024 18: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 June 11, 2024 09:29
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 March 27, 2024 13:58
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;
}
@Saifadin
Saifadin / useTypewriter.js
Last active January 25, 2019 18:31
Typewriter like "animation" for a string | Hooks
import { useState, useEffect } from 'react';
export const useTypeWriter = (text, startNow = true, speed = 100, skip) => {
const [toBeTyped] = useState(text);
const [displayedText, setDisplayedText] = useState('');
const [isDone, setIsDone] = useState(false);
const [intervalId, setIntervalId] = useState(null);
useEffect(
() => {
@nmarley
nmarley / docker_cid.sh
Created December 8, 2016 13:58
Docker — get container ID from within Docker container
bash-4.3# cat /proc/1/cpuset
/docker/13f8c221656e202db979d1e607c9c902282d8719ab70715978dd04ee6069d61e
bash-4.3# DOCKER_CID=$(cat /proc/1/cpuset | cut -c9-)
bash-4.3# echo $DOCKER_CID
13f8c221656e202db979d1e607c9c902282d8719ab70715978dd04ee6069d61e