Skip to content

Instantly share code, notes, and snippets.

View gkthiruvathukal's full-sized avatar

George K. Thiruvathukal gkthiruvathukal

  • Loyola University Chicago, Argonne National Laboratory (ALCF)
  • Chicago, IL, USA, North America, Earth, ..., Universe
  • LinkedIn in/gkthiruvathukal
View GitHub Profile
@gkthiruvathukal
gkthiruvathukal / tatsu-example.py
Created November 8, 2022 18:32
Use Tatsu to get generic AST and create IR
#!/usr/bin/env python3
import tatsu
import json
from pprint import pprint
GRAMMAR = """@@grammar::ZQUERY
start = expression $ ;
@gkthiruvathukal
gkthiruvathukal / KLSigPipeFun.scala
Created September 11, 2022 17:41
Tinkering with Konstantin's example
object KLSigPipeFun {
def main(args: Array[String]) = {
val lines = scala.io.Source.stdin.getLines()
val lineNumbers = 1 to Int.MaxValue
val numberedLines = lineNumbers.zip(lines)
val okLines = numberedLines takeWhile { _ => !scala.sys.process.stdout.checkError() }
val outLines = okLines map { case (number, line) => println(number + ":" + line) }
println(outLines.length + " lines counted")
}
}
ctags --output-format=json --fields="+n-P" rational.c
@gkthiruvathukal
gkthiruvathukal / Interval Tree Demo.ipynb
Created July 20, 2021 18:19
Interval Tree Python Example pairing with Nick Synovic
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
SCRIPT=$0
function get_line_self() {
local FILENAME=$1
local LN=$(($2 - 1))
local INFO=( $(sed "${LN}q;d" $FILENAME) )
echo ${INFO[0]}
}
### Comment
#!/usr/bin/env python3
# requires PyYAML & python-frontmatter
# pip install PyYAML
# pip install python-frontmatter
import frontmatter
import sys
import yaml
#!/usr/bin/env amm
import $ivy.`com.chuusai::shapeless:2.4.0-M1`
import shapeless._
println(scala.util.Properties.versionNumberString)
println(1 :: "lol" :: List(1, 2, 3) :: HNil)
#!/usr/bin/env amm
import $ivy.`com.chuusai::shapeless:2.4.0-M1`
import shapeless._
println(scala.util.Properties.versionNumberString)
println(1 :: "lol" :: List(1, 2, 3) :: HNil)
@gkthiruvathukal
gkthiruvathukal / .zshrc
Created May 1, 2021 15:34
current .zshrc file for OMZ, ZettelGeist, etc.
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/gkt/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@gkthiruvathukal
gkthiruvathukal / .inputrc
Created May 1, 2021 15:32
make it possible to use vim keybindings when getting additional prompts
set editing-mode vi