Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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>
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) {
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) {
#-*- 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
@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