Skip to content

Instantly share code, notes, and snippets.

@kayws426
kayws426 / biquad_cookbook.py
Created April 2, 2016 13:39 — forked from endolith/LICENSE.txt
Python implementation of "Cookbook formulae for audio EQ biquad filter coefficients"
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 28 18:51:00 2013
UNFINISHED AND BUGGY
Python/SciPy implementation of the filters described in
"Cookbook formulae for audio EQ biquad filter coefficients"
by Robert Bristow-Johnson
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
#-*- coding: utf8 -*-
# implementation of recipe on: http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
import numpy as n, pylab as p
# variaveis de parametrizacao
fa=44100.
f=2.
# tipos: LPF, HPF, BPF, BPF2, notch
# APF, peakingEQ, lowShelf, highShelf
int clock_gettime(int, struct timespec *tv)
{
static int initialized = 0;
static LARGE_INTEGER freq, startCount;
static struct timespec tv_start;
LARGE_INTEGER curCount;
time_t sec_part;
long nsec_part;
if (!initialized) {
int clock_gettime(int, struct timespec *tv)
{
LARGE_INTEGER curCount;
static int initialized = 0;
static LARGE_INTEGER freq, startCount;
static struct timespec tv_start;
time_t sec_part;
long nsec_part;
if (!initialized) {
@kayws426
kayws426 / aisgen.py
Created March 20, 2019 15:38 — forked from altendky/aisgen.py
Tools for working with Texas Instruments COFF and AIS files
#!/usr/bin/env python
'''Read fully linked TI COFF file, and generate AIS format file
Commandline parameters
enable sequential read,
pll and emifb configuration
pinmux configuration
enable checksums
'Eliot Blennerhassett' <eblennerhassett@audioscience.com>
@kayws426
kayws426 / tun-ping-win.py
Created July 17, 2019 01:12 — forked from glacjay/tun-ping-win.py
Reading/Writing OpenVPN's TUN/TAP Device under Windows using Python.
import _winreg as reg
import win32file
adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
def get_device_guid():
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters:
try:
@kayws426
kayws426 / pthread_wrapper.h
Created June 11, 2021 02:38
a single-header library to provide some pthread functions
//
// Cross Platform Thread Wrapper
// Refer: https://nachtimwald.com/2019/04/05/cross-platform-thread-wrapper/
//
// This file is a single-header library to provide some pthread functions
//
#ifndef __PTHREAD_WRAPPER_H__
#define __PTHREAD_WRAPPER_H__
@kayws426
kayws426 / lisparser.py
Last active August 5, 2023 14:37 — forked from roberthoenig/lisparser.py
Simple Lisp parser for Python 3.
import sys
from typing import Any, List
# Check input character is a token separator
def is_tok_sep(c: str) -> bool:
return c in "() \r\n\t\f"
# Parse input string into a list of all parentheses and atoms (int or str),
# exclude whitespaces.
@kayws426
kayws426 / ft2232_to_digilent_jtag.md
Created July 8, 2024 11:39 — forked from rikka0w0/ft2232_to_digilent_jtag.md
FT2232 to Digilent JTag for Xilinx FPGAs (ISE/Vivado)

The Digilent JTag uses FT2232, but its configuration EEPROM contains secrete data needed to be recoginzed by Xilinx ISE/Vivado. The following method only works on linux (tested on Ubuntu16.04), but the patched FT2232 doggle also works on Windows. Since WSL1 does not provide USB device access, the following method will not work for WSL1.

DONT use FT_Prog on offical Digilent cable, as it can trash the firmware! The offical eeprom contains secrete data that cannot be handled correctly by FT_Prog.

Here are steps to create a Digilent-like Jtag that can be used in Xilinx ISE and Vivado

  1. Install softwares: sudo apt-get install libftdi1 ftdi-eeprom
  2. Create a file "flash_digilent.conf" with the following content: