Skip to content

Instantly share code, notes, and snippets.

View w2sv's full-sized avatar

Janek Zangenberg w2sv

  • Berlin, Germany
View GitHub Profile
@w2sv
w2sv / Script.java
Created January 8, 2023 12:23
Periodically output averaged FPS in processing PApplet
import processing.core.PApplet;
import com.google.common.collect.EvictingQueue;
public class Sketch extends PApplet{
private final EvictingQueue<Integer> fpsValues = EvictingQueue.create(100);
private int lastFpsOutputSec = -1;
public void draw(){
fpsValues.add((int) frameRate);
@w2sv
w2sv / GetTreeUriPath.kt
Created January 6, 2023 14:14
Get document path corresponding to treeUri on Android
/**
* Way 1
*/
fun treeUriPath(contentResolver: ContentResolver, treeUri: Uri): DocumentsContract.Path? =
DocumentsContract.findDocumentPath(
contentResolver,
DocumentsContract.buildChildDocumentsUriUsingTree(
treeUri,
DocumentsContract.getTreeDocumentId(treeUri)
)
@w2sv
w2sv / install.sh
Last active September 16, 2022 13:58
Setting up tensorflow-gpu on Ubuntu 22.04
# $$$$$$$$$$ Pre-Installation $$$$$$$$$$$$$$$
# Ensure presence of cuda-compatible GPU
lspci | grep -i nvidia # should output something like '01:00.0 3D controller: <YOUR_NVIDIA_GPU_KIND> (rev a1)'
# Ensure gcc being installed
gcc --version
# Optional: install the nvidia cuda toolkit
sudo apt-get update