Skip to content

Instantly share code, notes, and snippets.

View lprib's full-sized avatar
🐡

Liam Pribis lprib

🐡
View GitHub Profile
@lprib
lprib / main.rs
Created March 17, 2022 10:58
Linear search vs HashSet
use std::collections::HashSet;
use std::ptr;
use std::time::Instant;
use rand::{distributions::Alphanumeric, prelude::SliceRandom, Rng};
fn test_speeds<T: PartialEq + Eq + std::hash::Hash + Clone>(
n: usize,
lookups: usize,
constructor: impl Fn() -> T,
@lprib
lprib / chan.py
Last active August 6, 2021 05:23
Delay spread rayleigh channel sim
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
from commpy.filters import rrcosfilter
fs = 48e3
def rayleigh(n, fs, doppler_hz):
t = np.arange(n) * (1/fs)
x = np.zeros(n)
----------------------------------------------
-- COMMON PACKAGE
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package common is
type complex_t is array(0 to 1) of signed(15 downto 0);
constant COMPLEX_T_0: complex_t := (X"0000", X"0000");
@lprib
lprib / cable_drape.pde
Last active December 14, 2020 08:48
Lagrange polynomial to approximate a cable drooping between two points
float p1x = 10;
float p1y = 200;
float p2x = 300;
float p2y = 200;
float p3x;
float p3y;
int numSegments = 30;
float droopLength = 10;
float sagCoefficient = 0.2;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
package common is
-- Read the next line of in_file as two space separated 16-bit signed.
-- Write data into a and b
procedure read_next_tuple (
file in_file: text;
@lprib
lprib / init.vim
Last active June 16, 2021 02:51
neovim config file
call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'rking/ag.vim'
Plug 'kien/rainbow_parentheses.vim'
Plug 'preservim/nerdcommenter'
Plug 'wincent/terminus'
Plug 'ludovicchabant/vim-lawrencium'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-sleuth'
Plug 'lervag/vimtex'
@lprib
lprib / prime-walk-animated.kt
Last active October 22, 2020 03:24
semi-random walk
import processing.core.PApplet
import processing.core.PConstants
import kotlin.math.ceil
import kotlin.math.sqrt
// NOTE: you need to add core.jar, gluegen-rt.jar, and jogl-all.jar to project build path
fun main(args: Array<String>) {
PApplet.main("MainAnimation")
}
PImage baseImage;
int iter=1, imageSize=1024, lerp=0;
void setup() {
size(1024, 1024);
baseImage=loadImage("oath.jpg");
loadPixels();
}
void draw() {
baseImage = ++lerp>imageSize/iter/2?get():baseImage;
iter = lerp>imageSize/iter/2?iter*2==imageSize?1:iter*2:iter;
#include <LiquidCrystal.h>;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char *menu_item_names[4] = {"Back", " Set", " Man", " Lim"};
int selected_menu_index = 1;
byte underline[8] = {
B11111,
B00000,
@lprib
lprib / vimium-link-style.css
Created September 1, 2020 06:00
link popup and vomnibar styling for vimium-ff