Skip to content

Instantly share code, notes, and snippets.

View DuaneNielsen's full-sized avatar
👾
Happy!

Duane DuaneNielsen

👾
Happy!
View GitHub Profile
@DuaneNielsen
DuaneNielsen / niri-ubuntu-24.04-setup.md
Created February 17, 2026 20:08
Niri Wayland compositor session setup on Ubuntu 24.04 with NVIDIA

Niri Session Setup on Ubuntu 24.04

Guide to getting niri working properly as a session manager with screen recording support.

Prerequisites

sudo apt install pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-gnome xdg-desktop-portal-gtk
@DuaneNielsen
DuaneNielsen / gist:e30e364754ce1b089dcb21c38fd609f5
Created February 17, 2026 18:03
Fix waybar not starting with niri compositor - portal timeout issue
# Fixing Waybar Not Starting with Niri Compositor
## Problem
Waybar fails to start when launched by niri, with errors like:
```
Error calling StartServiceByName for org.freedesktop.portal.Desktop: Failed to activate service 'org.freedesktop.portal.Desktop': timed out
```
@DuaneNielsen
DuaneNielsen / spotify-niri-setup.md
Created February 17, 2026 17:13
Spotify toggle setup for niri + waybar

Spotify Toggle Setup for Niri + Waybar

A clean Spotify integration for niri that gives you a floating, toggle-able Spotify window controlled from waybar.

Features

  • Click "Spotify" in waybar to show/hide the window
  • Spotify opens as a floating window in the top-right corner
  • Window remembers its position if you drag it
  • Track info shows in waybar with play/pause, next, previous controls
@DuaneNielsen
DuaneNielsen / droplist.gss
Last active August 7, 2025 05:48
Droplist For GSheets
function convertToDropdowns() {
// Get the selected range
var range = SpreadsheetApp.getActiveRange();
var values = range.getValues();
// Loop through each cell in the selection
for (var i = 0; i < values.length; i++) {
for (var j = 0; j < values[i].length; j++) {
var cellValue = values[i][j];
@DuaneNielsen
DuaneNielsen / MujocuMJXDemo.py
Last active March 31, 2025 07:20
2D Mujco MJX Demo with depth sensing and velocity control
import jax
import numpy as np
import matplotlib.pyplot as plt
import mujoco
from mujoco import mjx
import mediapy as media
from math import sin, cos
from tqdm import trange
@DuaneNielsen
DuaneNielsen / alphazero_es.py
Created September 8, 2024 18:34
AlphaZero Evolutionary Strategies
import gymnax
import flax.linen as nn
from argparse import ArgumentParser
import functools
from typing import Any, Callable, Sequence, Tuple, Optional, Sequence, Dict, Union, Iterable
import mctx
import warnings
from typing import Tuple, Optional, Union
import jax
import jax.numpy as jnp
from typing import Optional
import torch
from torch import tensor
from tensordict import TensorDict
from torchrl.data import CompositeSpec, BoundedTensorSpec, UnboundedContinuousTensorSpec, UnboundedDiscreteTensorSpec, DiscreteTensorSpec, \
UnboundedContinuousTensorSpec
from torchrl.envs import (
EnvBase,
Transform,
@DuaneNielsen
DuaneNielsen / pytorch_lightning_mnist_example.py
Created November 24, 2021 20:31
How to use pytorch lightning with bolts
import torch
import torch.nn.functional as F
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, LearningRateMonitor, EarlyStopping
from pytorch_lightning.plugins import DDPPlugin
from pl_bolts.datamodules import MNISTDataModule
class LightningMNISTClassifier(pl.LightningModule):
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.autograd import Function
from matplotlib import pyplot as plt
from torchvision.io import read_image
inf = float('inf')
mujoco in ~/.mujoco/mujoco200 (may need to rename)
ln -s ~/.mujoco/mujoco200 ~/.mujoco/mujoco200_linux
mujuco key in ~/.mujoco/mjkey.txt
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
sudo apt-get install libglew-dev
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/duane/.mujoco/mujoco200/bin
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so