Skip to content

Instantly share code, notes, and snippets.

View badjano's full-sized avatar
💭
unity + python + c++

Badjano badjano

💭
unity + python + c++
View GitHub Profile
#!/usr/bin/env python
import math
import pygame
import random
import rtmidi
from rtmidi.midiconstants import *
import time
TAU = 2 * math.pi
@jrh-spg
jrh-spg / diskclone.sh
Last active November 17, 2021 03:52
Disk Cloner Script that uses dd to clone disks
#!/bin/bash
# https://asciinema.org/a/6LZefsbvLjgsuwQHOnQsBEaSj
IF=notset
OF=notset
BS=128M
CURDIR=$(dirname $(realpath -s $0))
SCRIPT=`basename "$0"`
if [[ ! -f /usr/bin/pv ]]; then
echo "pv is not installed. Please install pv and try again"
# __ __
# / \ / \
# \__/ | |
# __ | | __
# / \______| | ________ ________ __| |__ ________
# | ______ | / __ \ / _____| |__ __| / _____|
# | | \__/ | / \ | | |_____ | | | |_____
# | | __ | | | | \_____ \ | | \_____ \
# | | / \ | \__/ | _____| | | |__ _____| |
# \__/ \__/ \________/ |________/ \_____| |________/
@JdaieLin
JdaieLin / 1.3_LCD_HAT_install.md
Last active March 6, 2021 19:42
Install waveshare 1.3 LCD HAT on Raspbian

在树莓派上点亮微雪1.3寸LCD HAT所需的安装步骤,重新梳理了一下安装顺序。

使用最新Raspbian镜像,联网进行安装。

安装 WiringPi

cd ~
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
// https://stackoverflow.com/questions/15095909/from-rgb-to-hsv-in-opengl-glsl
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}