Skip to content

Instantly share code, notes, and snippets.

View maurisvh's full-sized avatar

Mauris Van Hauwe maurisvh

View GitHub Profile
@maurisvh
maurisvh / spectrogram.py
Last active June 26, 2024 15:40
ANSI art spectrogram viewer that reads audio from a microphone
#!/usr/bin/python
import numpy
import pyaudio
import re
import sys
WIDTH = 79
BOOST = 1.0
import Control.Monad (when, forM)
import Data.Array
import Data.Char (isSpace)
import Data.List (elemIndices, transpose, intercalate)
import Data.Maybe (catMaybes)
import Data.Monoid ((<>))
import Data.Text (Text)
import System.Exit (die)
import Text.Printf (printf)
@maurisvh
maurisvh / fcast.hs
Last active January 20, 2017 00:32
tiny terminal livestreaming server
-- to watch: telnet localhost 8887
-- to stream: script -f >( (echo hello streamname; cat -) | nc -q5 localhost 8888 > /dev/tty )
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent
import Control.Concurrent.Chan
import Control.Concurrent.MVar
import Control.Monad