Skip to content

Instantly share code, notes, and snippets.

Dheepak Krishnamurthy kdheepak

View GitHub Profile
@kdheepak
kdheepak / documentation.jl
Last active May 27, 2020
generate helics documentation using libclang
View documentation.jl
using Clang
using HELICS
const HELICS_jll = HELICS.Lib.HELICS_jll
# LIBCLANG_HEADERS are those headers to be wrapped.
const LIBHELICS_INCLUDE = [
normpath(joinpath(HELICS_jll.artifact_dir, "include", "helics", "shared_api_library")),
normpath(joinpath(HELICS_jll.artifact_dir, "include", "helics")),
View generate-documentation.py
import helics as h
print("""## Enum""")
print("")
enum_blacklist = [
"helics_true",
"helics_false",
"helics_message",
@kdheepak
kdheepak / plot.py
Created Sep 2, 2016
Thread Safe Matplotlib
View plot.py
from matplotlib.figure import Figure
fig = Figure(figsize = (3, 3))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
@kdheepak
kdheepak / HELICS_GridLAB-D_GCC.md
Created Jan 17, 2019
Build GridLAB-D with HELICS, Boost and ZeroMQ using GCC on MacOSX
View HELICS_GridLAB-D_GCC.md

Install gcc

Install gcc using brew

brew install gcc

Install Boost

@kdheepak
kdheepak / paramiko_runner.py
Created Jan 2, 2019
paramiko non blocking example
View paramiko_runner.py
import sys
import paramiko
import os
import select
import getpass
import time
rpi = {
"username": getpass.getuser(),
"hostname": "hostname.of.server.here"
View log.py
import logging
log_format = (
"%(asctime)s - %(levelname)s [%(filename)s:%(lineno)d] : %(message)s"
)
logger = logging.getLogger(__name__)
s = logging.StreamHandler()
f = logging.Formatter(log_format)
s.setFormatter(f)
@kdheepak
kdheepak / pireceiver.py
Created Aug 24, 2018
ComboFederate Pi Exchange example
View pireceiver.py
import helics as h
fedinitstring = "--federates=1"
deltat = 0.01
helicsversion = h.helicsGetVersion()
print("PI RECEIVER: Helics version = {}".format(helicsversion))
# Create Federate Info object that describes the federate properties */
View .tmux.conf
# Change prefix key to `
unbind C-b
set -g prefix `
bind-key ` send-prefix
bind-key C-a set-option -g prefix C-a
bind-key C-b set-option -g prefix `
# we might need ` at some point, allow switching
bind-key C-a set-option -g prefix C-a
View logger.py
# Better Logging Format
## Author : Dheepak Krishnamurthy
## License : MIT
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter('%(asctime)s - [%(module)s(%(lineno)d)] - "%(name)s".%(levelname)s - %(message)s', "%Y-%m-%d %H:%M:%S")
ch.setFormatter(formatter)
View hide_cells_in_notebook.py
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
You can’t perform that action at this time.