Skip to content

Instantly share code, notes, and snippets.

Setting up CUDA and Pytorch on Windows Subsystem for Linux (WSL2)

2023-12-10

I recently set up CUDA and PyTorch to chat with LLMs and play with image recognition neural networks on my desktop. I used Windows Subsystem for Linux (WSL) to avoid running a full Linux alongside Windows 10. There are plenty of other guides for setting CUDA and WSL up, but this one is mine. Hopefully these notes will save someone else some time.

We roughly follow "Enable NVIDIA CUDA on WSL" here.

[!NOTE]

@g-k
g-k / symbols.py
Created June 14, 2021 18:08 — forked from luser/symbols.py
GDB Mozilla symbol server
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
#
# A GDB Python script to fetch debug symbols from the Mozilla symbol server.
#
# To use, run `source /path/to/symbols.py` in GDB 7.9 or newer, or
# put that in your ~/.gdbinit.
from __future__ import print_function

The following only works with the default user ('postgres'): gcloud sql connect --user If you try to connect using this command with any other user, the error message says FATAL: database 'user' does not exist. The workaround is to connect using the default user ('postgres'), then use the "\c" psql command to reconnect as the different user.

https://cloud.google.com/sql/docs/postgres/known-issues

Per :bobm:

cloud_sql_proxy -instances moz-fx-whatever-db-instance-name=tcp:PORT
psql postgres://USER@INTERNALIP:PORT/DBNAME
This file has been truncated, but you can view the full file.
{
"attributes": {
"JOB_NAME": "scan-3-depfiles-3f9e6fab",
"SCAN_ID": "3"
},
"data": [
{
"command": "curl -s \"https://raw.githubusercontent.com/mozilla/ssl-config-generator/master/package.json\" | tee \"package.json\";curl -s \"https://raw.githubusercontent.com/mozilla/ssl-config-generator/master/package-lock.json\" | tee \"package-lock.json\";",
"envvar_args": {
"BUILD_TARGET": "",
@g-k
g-k / keybase.md
Last active September 9, 2019 20:26

Keybase proof

I hereby claim:

  • I am g-k on github.
  • I am gguthe (https://keybase.io/gguthe) on keybase.
  • I have a public key ASAZtUtHBj2ihl6F-N_YWT8PbhwV-5XP_ofTYsXbb_kbzAo

To claim this, I am signing this object:

$ diff <(openssl asn1parse -in tls13-compat/META-INF/mozilla.rsa -inform DER -i) <(openssl asn1parse -in short-cn-org-sao/META-INF/mozilla.rsa -inform DER -i)
1c1
< 0:d=0 hl=4 l=4191 cons: SEQUENCE
---
> 0:d=0 hl=4 l=4362 cons: SEQUENCE
3,4c3,4
< 15:d=1 hl=4 l=4176 cons: cont [ 0 ]
< 19:d=2 hl=4 l=4172 cons: SEQUENCE
---
> 15:d=1 hl=4 l=4347 cons: cont [ 0 ]
@g-k
g-k / normandy.content-signature.mozilla.org-20200419.stage.chain
Created April 25, 2019 20:06
bad normandy content signature cert and chain
-----BEGIN CERTIFICATE-----
MIIC1DCCAlmgAwIBAgIIFZb+zh4c4R0wCgYIKoZIzj0EAwMwgaIxCzAJBgNVBAYT
AlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3
MRwwGgYDVQQKExNNb3ppbGxhIENvcnBvcmF0aW9uMRcwFQYDVQQLEw5DbG91ZCBT
ZXJ2aWNlczEvMC0GA1UEAxMmbm9ybWFuZHkuY29udGVudC1zaWduYXR1cmUubW96
aWxsYS5vcmcwHhcNMTkwMzIwMjE1NDQyWhcNMjAwNDE4MjE1NDQyWjCBojELMAkG
A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWlu
IFZpZXcxHDAaBgNVBAoTE01vemlsbGEgQ29ycG9yYXRpb24xFzAVBgNVBAsTDkNs
b3VkIFNlcnZpY2VzMS8wLQYDVQQDEyZub3JtYW5keS5jb250ZW50LXNpZ25hdHVy
ZS5tb3ppbGxhLm9yZzB2MBAGByqGSM49AgEGBSuBBAAiA2IABM0feofDqq4KyKZb
@g-k
g-k / notes.md
Created July 19, 2018 20:49
notes on finding content signature hash for normandy dev for mythmon

"This is controlled via the security.content.signature.root_hash preference, where the value is the hexadecimal of the sha2$ https://github.com/mozilla-services/autograph/blob/3dc9cfc9585bb8bc7b2b22f618ef8abadf18ddc9/signer/contentsignature/README.$

  1. get chain from x5u for normandy_key: in autograph dev config
  2. wget https://content-signature.stage.mozaws.net/chains/normandy.content-signature.mozilla.org-20180811.stage.chain
  3. split last pem cert in file from chain (should be root CN; check with openssl x509 -text)
  4. openssl x509 -outform der < normandy.content-signature.mozilla.org-20180811.stage.chain.2 | openssl dgst -sha256
#!/usr/bin/env node
`
example usage:
node ./screenshots_img_validation.js 'data:image/png;base64,R0k'
testing: data:image/png;base64,R0k
invalid-data-image { msg: 'Invalid PNG image submitted',
prefix: 'data:image/png;base64,R0k' }
/home/gguthe/screenshots_img_validation.js:24
** does EIS only want error logs, blocks, or also success (much larger log volume)? Going to say prob. errors only / no new l$
** which endpoints?
POST /blockEmail
POST /blockIp
POST /check
POST /checkAuthenticated
POST /checkIpOnly
POST /failedLoginAttempt
POST /passwordReset