Skip to content

Instantly share code, notes, and snippets.

View aniongithub's full-sized avatar

Ani aniongithub

View GitHub Profile
@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
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
@aniongithub
aniongithub / fixed_point_reconstruction.py
Created September 9, 2021 04:20
Reconstructing a signed floating point value from its 2's complement fixed point representation in a numpy/cupy friendly way
import numpy as np
from fxpmath import Fxp
N_FRAC = 8
BITS = 32
def twos_comp(val, bits):
# numpy/cupy/kernel friendly version of https://stackoverflow.com/a/9147327
sign_bits = (val & (1 << (bits - 1))) >> (bits - 1)
return np.int32(np.subtract(val, np.multiply(sign_bits, (1 << bits))))
@aniongithub
aniongithub / morton_coding.py
Created July 28, 2021 17:23
Recipe by Romain Dartigues to encode in a single number two or three numbers
# Adapted from recipes by Sean Eron Anderson and Fabian “ryg” Giesen
# all credits goes to the respective authors.
# http://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
# http://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/
# Encoding DEM using Morton coding: https://www.klokantech.com/labs/dem-color-encoding/
# Mirror of code from: https://code.activestate.com/recipes/577558/
def part1by1(n):
n&= 0x0000ffff
@aniongithub
aniongithub / CodeSpaces log
Created May 26, 2021 02:54
Codespaces failure - nativelibrary-dotnet-core
Configuration starting...
2021-05-26T02:44:31: $ git -C "/var/lib/docker/codespacemount/workspace" clone --depth 1 https://github.com/aniongithub/nativelibrary-dotnet-core "/var/lib/docker/codespacemount/workspace/nativelibrary-dotnet-core"
2021-05-26T02:44:31: Cloning into '/var/lib/docker/codespacemount/workspace/nativelibrary-dotnet-core'...
2021-05-26T02:44:31: git process exited with exit code 0
2021-05-26T02:44:33: $ git -C "/var/lib/docker/codespacemount/workspace/nativelibrary-dotnet-core" config --local remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
2021-05-26T02:44:33: git process exited with exit code 0
2021-05-26T02:44:33: @microsoft/vscode-dev-containers-cli 0.0.32.
2021-05-26T02:44:33: $ docker build -f /var/lib/docker/codespacemount/workspace/nativelibrary-dotnet-core/Dockerfile -t vsc-nativelibrary-dotnet-core-cdd73e13f35b6b589436a7f80ab2a349 /var/lib/docker/codespacemount/workspace/nativelibrary-dotnet-core
2021-05-26T02:44:34: Sending build context to Docker daemon 101.4kB
2021-05-