Skip to content

Instantly share code, notes, and snippets.

@netbrain
netbrain / capture.go
Last active September 14, 2020 08:33
Capture CGO output, realtime.
package main
//#include "capture.h"
import "C"
import (
"bufio"
"fmt"
"log"
"os"
"sync"
@netbrain
netbrain / errs.go
Created April 9, 2021 07:04
multiple errors
type errs []error
func (e errs) Error() string {
s := make([]string,len(e))
for i, err := range e {
s[i] = err.Error()
}
return strings.Join(s,",")
}
@netbrain
netbrain / gist:288ba07edee771f5c7fd086a0ea9f62e
Last active July 7, 2024 05:02
Windows 11 + WSL + DOCKER + NVIDIA
# Setup WSL
wsl --update
wsl --install -d Debian
# Enter WSL
wsl
# Setup base system
sudo apt update
sudo apt install -y --no-install-recommends apt-transport-https ca-certificates curl gnupg2 vim
@netbrain
netbrain / nixos-wsl
Created October 6, 2023 07:32
nixos wsl
# Function to download the tar file
function Download-NixOS {
$url = "https://github.com/nix-community/nixos-wsl/releases/latest/download/nixos-wsl.tar.gz"
$output = "$env:TEMP\nixos-wsl.tar.gz"
Invoke-WebRequest -Uri $url -OutFile $output
return $output
}
# Function to check if WSL is installed and install if it's not
function Install-WSL {