Skip to content

Instantly share code, notes, and snippets.

#-------------------------------------------------------------------------------
# PID.py
# A simple implementation of a PID controller
#-------------------------------------------------------------------------------
# Example source code for the book "Real-World Instrumentation with Python"
# by J. M. Hughes, published by O'Reilly Media, December 2010,
# ISBN 978-0-596-80956-0.
#-------------------------------------------------------------------------------
import time
/*
* This is an basic example show the various parsing and
*/
grammar example;
//Parsing rules
//This is the statement that tells ANTLR the structure of the program.
programBlock
@rkrishnasanka
rkrishnasanka / chthesis.sh
Last active February 24, 2016 22:08
Fluigi Tools
#!/bin/sh
#java -Xmx5000m -jar runFluigi.jar ../devices/chthesis/64.uf -i fluigi.ini -o eps
#java -Xmx5000m -jar runFluigi.jar ../devices_ali/xgrid_128.uf -i fluigi.ini -o eps
echo "Running Cassie's Thesis Benchmarks 2D"
for f in ../devices/chthesis/*.uf;
do
/**
* READ THIS LICENSE AGREEMENT CAREFULLY BEFORE USING THIS PRODUCT. BY USING
* THIS PRODUCT YOU INDICATE YOUR ACCEPTANCE OF THE TERMS OF THE FOLLOWING
* AGREEMENT. THESE TERMS APPLY TO YOU AND ANY SUBSEQUENT LICENSEE OF THIS
* PRODUCT.
*
* License Agreement for FLUTE
*
* Copyright (c) 2004 by Dr. Chris C. N. Chu
* All rights reserved
@rkrishnasanka
rkrishnasanka / mg.c
Last active April 6, 2018 19:50
multigrid code with annotations
/*======================================================================================
Rich Brower Sat May 28 00:23:17 EDT 2011
C program based on simple FMV code of S. F. McCormick, Multigrid Methods, Frontiers in Applied! Mathematics,
vol. 3, SIAM Books, Philadelphia, 1987.The code is intentionally put into a single file with no input parameters
to keep is concise. Of course a full code may have more traditional C structures!
We solve the 2-d Laplace problem: A phi = b
(A phi)((x,y) = [4 phi(x,y) - phi(x+1,y) - phi(x-1,y) - phi(x,y+1) -phi(x,y+1)]/a^2 + m^2 phi(x,y) = b(x,y)
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"layers": {
"type": "array",
"items": {
@rkrishnasanka
rkrishnasanka / command-frame.md
Created August 15, 2019 18:58
Command Frame Spec v1

Command Data Frame

Command Frame

5 bits 3 bits n bytes 3 bits n bytes 3 bits
command param-size (bytes) param-data param-size param-data end-sequence

This is complete frame that needs to be transmitted to the embedded device.

#!/usr/bin/python3
import json
from os import close
import sys
device = {}
with open(sys.argv[1]) as json_file:
import cairo
from parchmint import Device
import json
PT_TO_UM = 1/352.778
f = open("cariotest2.json", "r")
text = f.read()
@rkrishnasanka
rkrishnasanka / Pseudo-code.py
Last active January 28, 2021 13:55
Parchmint import pseudocode
def importMINTwithoutConstraints(self, device: MINTDevice) -> None:
self.__original_device = device
pcells = []
for component in device.components:
terminals = []
for port in component.ports:
t = CTerminal(