Skip to content

Instantly share code, notes, and snippets.

@briceburg
briceburg / gist:81d2c8d95a7cf4f61c0a
Created May 17, 2014 00:57
simple linux shell script to adjust backlight - useful for xmonad
#!/bin/bash
# backlight brightness controls. use freely
# and adjust sysfs directory if not on toshiba
# $author Brice Burgess @iceburg
sysfs="/sys/class/backlight/toshiba"
max=`cat ${sysfs}/max_brightness`
level=`cat ${sysfs}/brightness`
@Quasimondo
Quasimondo / rgb2yuv_yuv2rgb.py
Last active March 18, 2024 21:01
RGB to YUV and YUV to RGB conversion for Numpy
import numpy as np
#input is a RGB numpy array with shape (height,width,3), can be uint,int, float or double, values expected in the range 0..255
#output is a double YUV numpy array with shape (height,width,3), values in the range 0..255
def RGB2YUV( rgb ):
m = np.array([[ 0.29900, -0.16874, 0.50000],
[0.58700, -0.33126, -0.41869],
[ 0.11400, 0.50000, -0.08131]])
@jagrosh
jagrosh / Growing A Discord Server.md
Last active February 17, 2024 04:29
Tips for creating and growing a new Discord server

This guide is kept up-to-date as Discord and available resources change!
A basic server template is available here

Creating and Growing a Discord Server

logo

Introduction

Hello! I'm jagrosh#4824! I'm writing this guide to try to help new server owners set up and grow their servers, which is a commonly-requested topic. It's very easy to go about this the wrong way, so it's best to be prepared and make smart decisions so that your community can flourish!

Background

@metzenseifner
metzenseifner / ldconfig-fix.sh
Last active May 24, 2024 15:50
Fix ldconfig "file is empty, not checked" error
# Forcefully reinstall everything otherwise you might get "exists in filesystem" errors
pacman -Syyu $(pacman -Qnq) --force
@rkitover
rkitover / weston.service
Last active June 10, 2023 17:10
weston.service for systemd
[Unit]
Description=Weston Wayland compositor startup
RequiresMountsFor=/run
[Service]
User=rkitover
EnvironmentFile=-/etc/default/weston
Environment="XDG_RUNTIME_DIR=/run/user/1000"
Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/dbus/user_bus_socket"
ExecStartPre=/usr/bin/sudo /bin/mkdir -p /run/user/1000/dbus
@awesomebytes
awesomebytes / htc_vive_controller_keypresses.py
Last active February 3, 2024 23:51
Example on how to retrieve the HTC vive controller keypresses using pyopenvr
#!/usr/bin/env python
import time
import pprint
import openvr
"""
Get the HTC Vive controllers keypresses and print them to screen.
@Mnkai
Mnkai / README.md
Last active April 13, 2024 14:11
TDP and turbo parameter modification with MSR on non-overclockable Intel CPU (such as Intel i7-8550U)

TDP and turbo parameter modification with MSR on non-overclockable CPU

Disclaimer

  • MSR modification may void your CPU's (or system board's) warranty. Proceed with care. I'm not responsible for any destruction caused by this article.
  • MSR address (greatly) differs from CPU to CPU. Check your own CPU's MSR address using Intel's documentation.
  • Only tested on Intel i7-8550U (Kaby Lake R).
  • This article is translation of this article. If you can understand Korean, I recommend reading that article, not this.

Start

@marios8543
marios8543 / osu_parser.py
Created April 13, 2018 23:05
Parser for the osu! beatmap format written in python. Reads a beatmap file and converts it to json
import json
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file = filedialog.askopenfilename()
osu = open(file,'r+').readlines()
out = {}
sliders = ['C','L','P','B']
@G-UK
G-UK / Raspberry Pi 4 Arm64 Kernel Cross-Compile.md
Last active August 24, 2023 13:31
Building the Raspberry Pi 4 Arm64 Linux Kernel

The Raspberry Pi foundation have now released a beta version of an official 64-bit Kernel which can be installed using the rpi-update script. The rpi-update script can be found at https://github.com/Hexxeh/rpi-update/blob/master/rpi-update or through the Raspbian repositories

Introduction

The objective of these instructions is to build a stock 64bit Linux Kernel for use on the Raspberry Pi 4B on a Debian x64 machine (Windows Subsystem for Linux in my case), and deploy on the Raspberry Pi.

Notes:

  • Transfer to Pi is using my NAS in this example, replace with shared drive/memory stick etc. as required.
    • (N: drive on Windows and /mnt/NAS on Linux in this example).
  • For a specific Kernel version replace the 4.19 with the wanted version in the git clone command.
  • Greater than 3GB RAM only currently available on Kernel 4.19
@corycorvus
corycorvus / HapticPulse.cs
Created May 19, 2020 18:46
Haptic Vibrate Controller SteamVR and Oculus
using UnityEngine;
using UnityEngine.XR;
using Valve.VR;
// simple library and examples for XR haptics
// note: controllers must be tracking to use haptics
// other examples: https://vrtoolkit.readme.io/docs/vrtk_interacthaptics
public static class HapticPulse