Skip to content

Instantly share code, notes, and snippets.

@snmishra
snmishra / switcher.ahk
Created Sep 13, 2019
Switch windows by process name using Alt+` and S
View switcher.ahk
; Based on https://superuser.com/a/768060/542406
!`:: ; Next window
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, Count, ahk_exe %ActiveProcessName%
IF WinClassCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_exe %ActiveProcessName%
return
View gmid.py
# Python script for plotting curves for gm/Id method design
# MIT license. https://opensource.org/licenses/MIT
import sys
import os
sys.path.append(os.path.expanduser('~/src'))
import numpy as np
import rawread
import matplotlib as mpl
import matplotlib.pyplot as plt
arrs, plots = rawread.rawread(os.path.expanduser('~/ckt/gmid/gmid.raw'))
@snmishra
snmishra / gmid.sp
Last active Jan 13, 2021
Example testbench for generating gm/ID curves using ngspice
View gmid.sp
* gm/Id simulation
* public domain
.param ll=250n vg=1 vd=0.7 vdd=1.1
* Download models from http://ptm.asu.edu/modelcard/LP/45nm_LP.pm
.inc "../PTM-MG/45nm_LP.pm"
vg vg 0 vg
vdn dn 0 'vd'
vdp dp 0 '-vd'
@snmishra
snmishra / find_python.patch
Created Mar 23, 2016
Patch to support Python 2.6 in find_python.sh of WANdisco SRPM
View find_python.patch
--- build/find_python.sh 2015-12-15 20:07:28.000000000 -0800
+++ build/find_python.sh 2015-12-15 20:07:45.000000000 -0800
@@ -21,7 +21,7 @@
#
# Required version of Python
-VERSION=${1:-0x2070000}
+VERSION=${1:-0x2060000}
for pypath in "$PYTHON" "$PYTHON2" "$PYTHON3" python python2 python3; do
@snmishra
snmishra / capsulethunk.patch
Created Mar 23, 2016
Patch for using capsulethunk in subversion swigutil_py.h
View capsulethunk.patch
--- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2015-12-15 19:40:06.000000000 -0800
+++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2015-12-15 19:34:05.000000000 -0800
@@ -39,6 +39,8 @@
#include "svn_client.h"
#include "svn_repos.h"
+#include "capsulethunk.h"
+
/* Define DLL export magic on Windows. */
#ifdef __cplusplus
View subversion-1.9.x.spec.patch
--- subversion-1.9.x.spec 2015-12-08 08:59:20.000000000 -0800
+++ subversion-1.9.x.spec 2015-12-15 20:09:01.000000000 -0800
@@ -10,6 +10,10 @@
%define swig_version 1.3.29
%define apache_dir /usr
%define pyver 2.6
+%define svn_version 1.9.3
+%define svn_source subversion-%{svn_version}.tar.gz
+%define svn_rc ""
+%define svn_release 1
@snmishra
snmishra / rawread.py
Last active Oct 22, 2021
Short python script to read ngspice raw binary files
View rawread.py
# MIT license: https://opensource.org/licenses/MIT
# See https://github.com/Isotel/mixedsim/blob/master/python/ngspice_read.py
# for a more complete library. Isotel's version is GPL licensed
from __future__ import division
import numpy as np
BSIZE_SP = 512 # Max size of a line of data; we don't want to read the
# whole file to find a line, in case file does not have
# expected structure.
MDATA_LIST = [b'title', b'date', b'plotname', b'flags', b'no. variables',
b'no. points', b'dimensions', b'command', b'option']