Skip to content

Instantly share code, notes, and snippets.

@Knifa
Knifa / vr-power
Last active September 1, 2025 13:30
A "nice" script for setting power management controls for AMD cards on Linux, as per the recommendations on the Linux VR Adventures wiki.
#!/bin/bash
set -eou pipefail
CARD=""
for card_path in /sys/class/drm/card*/device; do
if [[ -L "$card_path/driver" ]] && [[ $(basename $(readlink "$card_path/driver")) == "amdgpu" ]]; then
CARD="$card_path"
break
fi
@Knifa
Knifa / waves.py
Last active December 1, 2022 12:15
from __future__ import annotations
import colorsys
import random
import time
Grid = list[list[int]]
Weights = list[list[float]]
WIDTH = 40
from PIL import Image, ImageDraw
char_width = 12
char_height = 18
chars_x = 16
chars_y = 16
black = (128, 128, 128, 255)
white = (255, 255, 255, 255)
import bpy
import os
from mathutils import Vector
from math import radians, sqrt, sin, cos, tan, pi
CAM_DEGREES = radians(60)
@Knifa
Knifa / ok.py
Created October 31, 2017 19:22
import math
import timeit
import random
def combsort(shrink, data):
gap = len(data)
sorted = False
while not sorted:
gap = math.floor(gap / shrink)
@Knifa
Knifa / example.ino
Last active September 8, 2017 20:07
#include <Adafruit_NeoPixel.h>
// It's good to name these what they mean rather than what they are!
#define PIN_LED_STRIP_FRONT 2
#define PIN_LED_STRIP_REAR 6
#define NUM_LEDS 10
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
#[derive(Clone, Copy)]
#[repr(u32)]
pub enum Enum_Unnamed37 {
UndefinedFilter = 0,
PointFilter = 1,
BoxFilter = 2,
TriangleFilter = 3,
HermiteFilter = 4,
HanningFilter = 5,
HammingFilter = 6,
function Logger(id)
{
this.id = id;
this.rawLog = [];
// Variables of Logs
// Contains their values [0[ & COOJA timestamp [n-1]
this.macAdd = [];
this.csmaChannel = [];
this.ipv6LinkLocal = [];
this.collectProcessId = []; // Client/Server?
function keyDown(e:KeyboardEvent):void {
trace('A key has been pressed.');
trace(e.keyCode);
trace(e.charCode);
if (e.keyCode == Keyboard.SPACE) {
trace('Space was pressed.');
}
}
#include <Servo.h>
#include "SerialParser.h"
/*--------------------------------------------------------------------------------------*/
#define SERVO_COUNT 32
/*--------------------------------------------------------------------------------------*/
Servo servos[SERVO_COUNT];