Skip to content

Instantly share code, notes, and snippets.

View NeilPandya's full-sized avatar
♻️
I may be slow to respond.

Neil Pandya NeilPandya

♻️
I may be slow to respond.
View GitHub Profile
@NeilPandya
NeilPandya / checkTorchOpenCV.py
Created September 21, 2024 18:54
Check OpenCV with PyTorch
import torch
import os
print('availabe:',torch.cuda.is_available() )
print('devices available', torch.cuda.device_count())
print('device id:',torch.cuda.current_device() )
print('device address', torch.cuda.device(0))
print('gpu model',torch.cuda.get_device_name(0))
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
@NeilPandya
NeilPandya / howToDocument.md
Created September 21, 2024 18:50
A Good Way to Document

A Good Way to Document

I hate that I have to do this, but I've been using Stack Overflow and Stack Exchange for over a decade and I know how negative people can be.

The Problem

I teach children and adults to hack RaspberryPi, Arduino, ESP8266, etc. at multiple Maker Spaces. My issue was with the package libsoxr0:armhf but Google found this to be the most relevant question.

In my case I searched for my exact error message:

@NeilPandya
NeilPandya / generateRainbow.html
Created September 21, 2024 18:41
Generate a Rainbow in HTML
<!--
"I am trying to generate rainbow colors based on the numeric value."
var max = 10000;
var min = 0;
var val = 8890;
function getcolor(min,max,val) {
// return red - black;
}
@NeilPandya
NeilPandya / x11vncSDDM.md
Last active September 21, 2024 16:50
x11vnc & SDDM & Kubuntu

x11vnc & SDDM & Kubuntu

SDDM with 16.04 LTS introduces two new problems that did not exist with 15.10 or 14.04:

  1. The option HideShells in /etc/sddm.conf does not work correctly. When more than one shell is specified, the filter does not work and the matching users are listed in the greeting screen notwithstanding.

  2. The xauthority (or MIT-MAGIC-COOKIE) file is no longer at /var/run/sddm/:0 but at an unpredictable location like /var/run/sddm/{ca7d6d45-9b4d-4a92-997e-c9c11081dea1} which is build by including a random UUID in the path. When trying to start x11vnc, for example, that file cannot be found. With 15.10, one could start x11vnc with /usr/bin/x11vnc -auth /var/run/sddm/:0 -display :0 -rfbauth /etc/vncpasswd -rfbport 5943 -reopen -forever, this is no longer possible.

The second bug is uncool with Ubuntu server for remote root servers.