Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
rkrishnasanka / docker-deploy.sh
Last active March 25, 2024 13:33
Simple Docker Compose -> EC2 Deploy
#!/usr/bin/env bash
TARGET='main'
ACTION='\033[1;90m'
NOCOLOR='\033[0m'
cd ~/<fill the right code location> || exit
if [[ -z "$1" && $1 != "--force" ]]; then
# Checking if we are on the main branch
@rkrishnasanka
rkrishnasanka / index.ts
Created April 15, 2023 23:15 — forked from d-nishi/index.ts
EKS RBAC - verbose index.ts
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
/*
* 1) Single step deployment three IAM Roles
*/
// Administrator AWS IAM clusterAdminRole with full access to all AWS resources
@rkrishnasanka
rkrishnasanka / indigo_test.py
Last active August 4, 2022 14:24
epam Indigo Package Python Examples
from indigo import Indigo
from indigo.renderer import IndigoRenderer
from indigo.inchi import IndigoInchi
indigo_object = Indigo()
mol1 = indigo_object.loadMolecule("ONc1cccc1")
print(mol1.smiles())
@rkrishnasanka
rkrishnasanka / svg2STL.py
Created October 17, 2021 22:54
FreeCAD script to convert SVG objects to STL
```
Based on https://github.com/kefir-/SVG2Solid
```
from FreeCAD import Base
import importSVG
import Part
def extrudeSVG(filename, thickness):
@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(
import cairo
from parchmint import Device
import json
PT_TO_UM = 1/352.778
f = open("cariotest2.json", "r")
text = f.read()
#!/usr/bin/python3
import json
from os import close
import sys
device = {}
with open(sys.argv[1]) as json_file:
@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.

{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"layers": {
"type": "array",
"items": {
@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)