Skip to content

Instantly share code, notes, and snippets.

View agrif's full-sized avatar

agrif agrif

View GitHub Profile
pub async fn run(&mut self) -> anyhow::Result<()> {
let mut now = Time::frames(0);
loop {
for ad_or_news in &[true, false] {
//let _: u8 = true;
for _ in 0..1 {
self.play_music().await?;
if *ad_or_news {
self.play_ad().await?;
let mut fileio = sf::SF_VIRTUAL_IO {
get_filelen: Self::vio_get_filelen,
seek: Self::vio_seek,
read: Self::vio_read,
//write: unsafe { std::mem::transmute(std::ptr::null::<libc::c_void>()) },
write: Self::vio_write,
tell: Self::vio_tell,
};
@agrif
agrif / main.c
Created February 14, 2021 05:19
#include <stdint.h>
#include <mcs51/at89x051.h>
#define OSCILLATOR_FREQ 12000000
// assuming 8-bit counter in timer
#define INTERRUPTS_PER_SECOND (OSCILLATOR_FREQ / ((1 << 8) * 12))
// display multiplexing
#define DISPLAY_FREQ 1000 * 3
import random
import sqlite3
import timeit
import numpy
import tempfile
import os.path
A_VALUES = ['foo', 'bar', 'baz']
B_VALUES = ['magrat', 'nanny', 'granny']
# link to vcpkg libsndfile
# https://github.com/evpobr/sndfile-sys
[target.'cfg(all(windows, target_env="msvc"))']
#[build]
rustflags = ["-Ctarget-feature=+crt-static"]
@agrif
agrif / pixelate-rectangle.shader
Last active October 1, 2020 23:59 — forked from ion1/pixelate-rectangle.shader
Censor a part of the screen (such as a chat window) by pixelation in obs-shaderfilter
// Censor a part of the screen (such as a chat window) by pixelation in
// obs-shaderfilter.
// https://obsproject.com/forum/resources/obs-shaderfilter.775/
// https://creativecommons.org/publicdomain/zero/1.0/
// To the extent possible under law, ion has waived all copyright and related
// or neighboring rights to obs-pixelate-rectangle. This work is published
// from: Suomi.
// originally from
// Author: Aaron Griffith
// License: MIT
uniform int strips; // = 10;
uniform float seed; // = 0.0;
uniform vec4 background; // = vec4(0.0, 0.0, 0.0, 1.0)
uniform bool twopart; // = true;
// https://stackoverflow.com/a/4275343
// Author: Aaron Griffith
// License: MIT
const int count = 400;
uniform float seed; // = 0.0;
uniform vec4 background; // = vec4(0.0, 0.0, 0.0, 1.0)
uniform bool twopart; // = true;
// https://stackoverflow.com/a/4275343
pub static LITERAL: CanonicalHuffman<&'static [u8]> = unsafe {
CanonicalHuffman::new(
&[0, 0, 0, 0, 1, 11, 20, 21, 16, 7, 5, 10, 91, 74],
&[
0x20, 0x45, 0x61, 0x65, 0x69, 0x6c, 0x6e, 0x6f,
0x72, 0x73, 0x74, 0x75, 0x2d, 0x31, 0x41, 0x43,
0x44, 0x49, 0x4c, 0x4e, 0x4f, 0x52, 0x53, 0x54,
0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x6d, 0x70,
0x0a, 0x0d, 0x28, 0x29, 0x2c, 0x2e, 0x30, 0x32,
0x33, 0x34, 0x35, 0x37, 0x38, 0x3d, 0x42, 0x46,
[
{
"index": 1,
"fade-flags": 0,
"looping": 1,
"global-volume": 155,
"u0": 0,
"u1": 0,
"sounds": [
{