Skip to content

Instantly share code, notes, and snippets.

View aniongithub's full-sized avatar

Ani aniongithub

View GitHub Profile
@aniongithub
aniongithub / CMakeLists.txt
Last active February 25, 2025 07:16
Use glad as a static lib with CMake FetchContent
...
# https://github.com/Dav1dde/glad/issues/397#issue-1463640603
# This doesn't work out of the box with conflicting targets, forcing shared libs, etc.
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # Ugly way to force static glad build
# Fetch GLAD from GitHub
FetchContent_Declare(glad_src
GIT_REPOSITORY https://github.com/Dav1dde/glad.git
@aniongithub
aniongithub / .bash_aliases
Last active February 11, 2025 18:43
Add a shareable monitor to the lower left of a 4K (2160p) monitor with xrandr
# Save this to your ~/.bash_aliases file or ~/.bashrc directly
alias add-monitor="xrandr --setmonitor screenshare 1920/1x1080/1+0+1080 none"
alias remove-monitor="xrandr --delmonitor screenshare"
@aniongithub
aniongithub / add_timer.sh
Last active September 12, 2024 18:44
Add a timer or other text display to a video using FFMPEG
#!/bin/bash
# From: https://discuss.kde.org/t/date-time-overlay-in-timelapse-video/2880/5
# Monospaced font from here: https://www.1001fonts.com/download/digital-7.zip
INPUT_FILE="video.mp4"
TOTAL_DURATION=30 # Total duration in seconds
FPS=30
FONT_FILENAME="./digital-7/digital-7 (mono).ttf"
FONT_SIZE=72
@aniongithub
aniongithub / gltf_utils.py
Last active December 26, 2023 05:31
Render GLTF skeleton at time "t" in matplotlib
from collections import deque
from enum import Enum, IntEnum, auto
from typing import Callable, Concatenate, Dict, List, Tuple, Union
import numpy as np
import pytransform3d.rotations as pr
import pytransform3d.transformations as pt
from matplotlib.axes import Axes
from pygltflib import Accessor, Node, GLTF2
@aniongithub
aniongithub / load_model_from_gltf.ipynb
Last active September 6, 2023 06:11
Load gltf in pythreejs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aniongithub
aniongithub / Dockerfile
Created April 19, 2023 02:12
Dockerfile using docker-systemctl-replacement and heredoc for unit file
# syntax=docker/dockerfile:1.3-labs
# Enable heredoc syntax https://collabnix.com/using-heredocs-in-dockerfiles-simplify-your-image-building-process/
FROM ubuntu
RUN wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -O /usr/local/bin/systemctl &&\
chmod +x /usr/local/bin/systemctl
RUN cat <<EOF > /etc/systemd/system/memgraph.service
[Unit]
@aniongithub
aniongithub / sgc_designations.py
Created April 4, 2023 22:02
Stargate SGC planet designation creator
import random
import string
def generate_sgc_planet_designation(galaxy='Milky Way', include_char=True):
# Quadrants: M (Milky Way) or P (Pegasus)
quadrant = 'M' if galaxy == 'Milky Way' else 'P'
# Region within the quadrant (1-9)
region = random.randint(1, 9)
@aniongithub
aniongithub / README.md
Last active December 21, 2022 21:33
Install nvidia GPU drivers on Ubuntu server

Installing Nvidia GPU drivers on Ubuntu server

Since the default distro installation didn't work for me, here's an alternative method.

  • Ensure that the nvidia drivers are removed from the kernel mod blacklist by running grep nvidia /etc/modprobe.d/* /lib/modprobe.d/* and moving/deleting/commenting any files/lines that contain this reference. For me, this file was: /etc/modprobe.d/blacklist-framebuffer.conf
  • We need to disable the default Nouveau driver by creating /etc/modprobe.d/disable-nouveau.conf that contains
blacklist nouveau
options nouveau modeset=0
@aniongithub
aniongithub / LinqImageProcessing.cs
Last active May 25, 2023 06:27
Linq based Bitmap image processing
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
public interface IImageFormat
{
@aniongithub
aniongithub / setup.py
Last active October 1, 2021 05:10 — forked from jpmens/MANIFEST.in
Including git version in setup.py files. (Requires at least _one_ tag in the repo) Normally used to make things like, "python setup.py sdist" give you a predictable name for files. Normally used with tags on the repo like 0.1 or 2.3.0. This fork will tag all non-git working folders as a "dev" version.
from setuptools import setup
# from https://gist.github.com/dcreager/300803 with "-dirty" support added
from version import get_git_version
# From http://bugs.python.org/issue15881
try:
import multiprocessing
except ImportError:
pass