Skip to content

Instantly share code, notes, and snippets.

View JasonLG1979's full-sized avatar
😜
Never Really Busy

Jason Gray JasonLG1979

😜
Never Really Busy
View GitHub Profile
@JasonLG1979
JasonLG1979 / fir_low_pass_filter.rs
Last active June 10, 2023 09:36
Super basic FIR low pass filter with no dependencies outside std.
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
@JasonLG1979
JasonLG1979 / resampler.rs
Last active June 16, 2023 09:58
Dual threaded Stereo Linear or Windowed Sinc Resampler from 44.1kHz to 48kHz, 88.2kHz or 96kHz with no dependencies outside std.
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
@JasonLG1979
JasonLG1979 / vectest.rs
Last active June 24, 2021 17:33
Test to see if Vec capacity can be trusted in Rust.
fn main() {
// This may take a while to run...
let ten_mega_bytes: usize = 10_000_001;
println!("Testing Vec `with_capacity`, `reserve`, and `reserve_exact` in range 0..{} (ten megabytes)", ten_mega_bytes);
for i in 0..ten_mega_bytes {
let mut with_capacity: Vec<u8> = Vec::with_capacity(i);
let mut reserve: Vec<u8> = Vec::new();
reserve.reserve(i);
let mut reserve_exact: Vec<u8> = Vec::new();
reserve_exact.reserve_exact(i);
@JasonLG1979
JasonLG1979 / asound.conf
Last active September 9, 2022 01:27
/etc/asound.conf
# /etc/asound.conf
###############################################################################
pcm.hqstereo20 {
@args [
SAMPLE_RATE FORMAT BUFFER_PERIODS
BUFFER_PERIOD_TIME VOL_MIN_DB
VOL_MAX_DB VOL_RESOLUTION VOL_NAME
]
@JasonLG1979
JasonLG1979 / asound.conf
Last active October 2, 2020 02:56
asound.conf
defaults.pcm.card 1 # Change to the card you want to be default.
defaults.ctl.card 1 # Change to the card you want to be default.
ctl.!default {
type plug
# slave.pcm "HQstereoHardWareVol20:CARD=0,DEV=0,SUBDEV=-1,RATE=44100,FORMAT=S16_LE,RATE_CONVERTER=samplerate_linear,PERIODS=4,PERIOD_TIME=125000"
# slave.pcm "HQstereoSoftWareVol20:CARD=0,DEV=0,SUBDEV=-1,RATE=44100,FORMAT=S16_LE,RATE_CONVERTER=samplerate_linear,PERIODS=4,PERIOD_TIME=125000"
slave.pcm "HQstereoHardWareVol20:CARD=1"
}
#!/usr/bin/env python3
# Copyright (c) 2020 Jason Gray <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@JasonLG1979
JasonLG1979 / SmartImage.py
Last active December 4, 2017 17:01
Gtk.Widget.get_scale_factor is broken and always returns 1. This will make sure your Gtk.Image scales automatically based on scale factor and will fallback gracefully on error.
#
# Copyright (C) 2017 Jason Gray <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
@JasonLG1979
JasonLG1979 / mpris_dbus.py
Created November 26, 2017 18:38
PyGObject MPRIS
#
# Copyright (C) 2017 Jason Gray <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
@JasonLG1979
JasonLG1979 / mate-mpris.ui
Last active October 5, 2024 19:37
UI File for Mate MPRIS Applet players
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.1
Copyright (C) 2017
This file is part of Mate MPRIS Panel Applet.
Mate MPRIS Panel Applet is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
#
# Copyright (C) 2017 Jason Gray <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR