Skip to content

Instantly share code, notes, and snippets.

View rxa254's full-sized avatar
💭
Clear

Rana X Adhikari rxa254

💭
Clear
View GitHub Profile
@rxa254
rxa254 / livespec.py
Created March 20, 2023 20:26 — forked from boylea/livespec.py
pyqtgraph live running spectrogram from microphone
"""
Tested on Linux with python 3.7
Must have portaudio installed (e.g. dnf install portaudio-devel)
pip install pyqtgraph pyaudio PyQt5
"""
import numpy as np
import pyqtgraph as pg
import pyaudio
from PyQt5 import QtCore, QtGui
@rxa254
rxa254 / gist:65e365ecc58d2d9c8887
Created November 30, 2015 05:21 — forked from lucaspiller/gist:3377737
Tmux Primer

I use this function to setup / resume my tmux sessions. If a session exists with the given name it resumes it, otherwise it creates it:

tm() {
  [[ -z "$1" ]] && { echo "usage: tm <session>" >&2; return 1; }
  tmux has -t $1 && tmux attach -d -t $1 || tmux new -s $1
}

(N.b. If you use something similar already check you have the -d flag. This will kill old clients (e.g. ssh connections that died, quitting your terminal before disconnecting) and ensure the window resizes correctly.)