Skip to content

Instantly share code, notes, and snippets.

@snmishra
snmishra / rawread.py
Last active January 22, 2024 10:22
Short python script to read ngspice raw binary files
# 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']
@snmishra
snmishra / Dockerfile
Last active April 29, 2023 17:54
Slimmed Playwright image
FROM node:18-slim as builder
ARG PLAYWRIGHT_VERSION
ARG PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN npx playwright@${PLAYWRIGHT_VERSION} install chromium
FROM node:18-slim as runner
ARG PLAYWRIGHT_VERSION
ARG PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
COPY --from=builder /ms-playwright /ms-playwright
RUN npx playwright@${PLAYWRIGHT_VERSION} install-deps chromium
USER node
@snmishra
snmishra / switcher.ahk
Created September 13, 2019 15:09
Switch windows by process name using Alt+` and S
; 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
# 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 January 13, 2021 07:18
Example testbench for generating gm/ID curves using ngspice
* 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 March 23, 2016 16:18
Patch to support Python 2.6 in find_python.sh of WANdisco SRPM
--- 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 March 23, 2016 16:17
Patch for using capsulethunk in subversion swigutil_py.h
--- 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
--- 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