Skip to content

Instantly share code, notes, and snippets.

@jondoesntgit
jondoesntgit / compile-tikz.py
Created September 24, 2020 14:27
Subliem Tikz Compile Plugin
import sublime
import sublime_plugin
import os
import subprocess
import time
COMPILE_DIRECTORY = '/tmp/sublime-tikz'
TEMPLATE_FILE = os.path.join(os.path.dirname(__file__), 'template.tex')
try:
@jondoesntgit
jondoesntgit / wheelertikz.sty
Created September 24, 2020 14:22
wheelertikz.sty
% This is my first package
% jamwheel@stanford.edu
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{wheelertikz}[2020-09-24 Package for drawing Tikz Figures for PhD program]
\usepackage{helvet}
\RequirePackage{helvet}
\RequirePackage{sfmath}
\usetikzlibrary{positioning, calc, shapes}
@jondoesntgit
jondoesntgit / NIDAQmxBase.h
Created March 28, 2019 14:14
NIDAQmxBase.h
/*============================================================================*/
/* National Instruments / Data Acquisition */
/*----------------------------------------------------------------------------*/
/* Copyright (c) National Instruments 2015. All Rights Reserved. */
/*----------------------------------------------------------------------------*/
/* */
/* Title: nidaqmxbase.h */
/* Purpose: Include file for NI-DAQmxBase library support. */
/* */
/*============================================================================*/
@jondoesntgit
jondoesntgit / 190328a_nidaqmx_base.log
Created March 28, 2019 13:48
190328a_nidaqmx_base.log
>>> from instrumental.drivers.daq.ni import DAQ
[ INFO]2019-03-28 06:44:50,028 nicelib.nicelib: Creating class NiceObject...
[ INFO]2019-03-28 06:44:50,028 nicelib.nicelib: Creating class NiceObject...
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: Creating class NiceLib...
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: Creating class NiceLib...
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: Processing attr '__module__' (<class 'str'>)...
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: Processing attr '__module__' (<class 'str'>)...
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: ...as an ordinary class attribute
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: ...as an ordinary class attribute
[ INFO]2019-03-28 06:44:50,030 nicelib.nicelib: Processing attr '__qualname__' (<class 'str'>)...
@jondoesntgit
jondoesntgit / slide_creator.py
Created December 2, 2018 01:20
slide_creator.py
#!/usr/bin/python
import tkFileDialog
from Tkinter import *
import sys
import re
class scrollTxtArea:
def __init__(self,root):
frame=Frame(root)
@jondoesntgit
jondoesntgit / ltspice2python.py
Created September 25, 2018 22:34
LTSpice to Python
# Some regular expression for parsing LTSpice gain files
import re
regex = r"^([\.0-9e+-]+)\t\(([\.0-9e+-]+)dB,([-0-9\.e+-]+)°\)"
path = # Insert your path here
with open(path) as file:
matches = re.finditer(regex, file.read(), re.MULTILINE)
freq, gain, phase = zip(*[(float(m.group(1)), float(m.group(2)), float(m.group(3))) for m in matches])
@jondoesntgit
jondoesntgit / scale_factor_vs_voltage.py
Last active December 15, 2017 00:34
Scale Factor Fitting for Voltage
%pylab inline
from hardware import *
import pyfog
import time
import pandas as pd
from scipy.optimize import curve_fit
scale_factors = pd.DataFrame(columns=['scale_factor'])
for vpp in linspace(1.6, 2.5, 5):
@jondoesntgit
jondoesntgit / 24.py
Created December 8, 2017 01:54
Script for finding all solutions to the card game "24"
import numpy as np
def combine(*args):
if len(args) == 2:
return np.concatenate([(x*y, x+y, abs(x-y), x/y, y/x) for x in args[0] for y in args[1]])
return np.concatenate([combine(combine(*np.roll(args, i)[1:]), np.roll(args,i)[0]) for i in range(len(args))])
vals = (np.arange(10) + 1).astype(np.float64)
for x in ("%i %i %i %i, %s" % (a,b,c,d, 24 in combine([a], [b], [c], [d])) for a in vals for b in vals for c in vals for d in vals if a <= b and b <= c and c <= d ):
print(x)
import numpy as np
def combine(*args):
@jondoesntgit
jondoesntgit / Untitled.ipynb
Last active December 5, 2016 23:43
IPython example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jondoesntgit
jondoesntgit / crosswalk.ino
Created August 16, 2016 19:38
Crosswalk Arduino
#include <Servo.h>
// Power pin is normally OFF
// Walk pin is normall ON
int walkPin = 2;
int powerPin = 3;
int togglePin = 3;
int bellPin = 12;