Skip to content

Instantly share code, notes, and snippets.

View TestSubjector's full-sized avatar

Kumar Prasun TestSubjector

View GitHub Profile
@TestSubjector
TestSubjector / copyfail.lua
Last active November 22, 2020 17:54
How deepcopying in Lua may not be enough
local node = parser:entry_stat(lex)
local diff_node = copy(node, getmetatable(node))
print(node.node_type) -- returns ast.unspecialized.top.Task
print(diff_node.node_type) -- returns ast.unspecialized.top.Task
print(node.node_type == ast.unspecialized.top.Task) -- returns False
print(diff_node.node_type == ast.unspecialized.top.Task) -- returns False
for k, v in pairs(ast.unspecialized.top.Task) do
@TestSubjector
TestSubjector / HDF5.js
Last active September 29, 2020 08:18
Sample HDF5 Content
// Given below is a view of what the HDF5 files content can look like.
// This information can be found by using the `H5DUMP` command.
// File Start
HDF5 "point/point.h5" {
GROUP "/" {
GROUP "1" {
ATTRIBUTE "total" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
@TestSubjector
TestSubjector / Grammar.md
Last active August 31, 2023 11:15
Context Free Grammar For Julia

Julia Grammar Syntax

< program > ::= < expression_list >   
    
< expression_list > ::= < expression > < terminator > |  
                        < expression > < terminator > < expression_list >  
                          
< expression > ::= < number > |  
 < string > | 
@TestSubjector
TestSubjector / ComplexTaylorSeriesMethod.py
Created September 2, 2018 06:51
Quick gist for two numerical methods to compute derivatives, mainly to show the error they generate (vs step size) as a plot
import numpy as np
import cmath
import matplotlib.pyplot as plt
def input_function(x):
return cmath.log(x)
def input_deravative_function(x):
return 1/x
@TestSubjector
TestSubjector / LogicAssignment_README.md
Last active November 15, 2017 07:01
CS F213 - Logic Assignment Task [ *Convert from Infix to Postfix | * Convert Postfix into a parse tree | * Get Infix from parse tree via in-order traversal ]

To run the main code, go to the directory containing the files and run the following commands on bash/terminal.

  • gcc -o main central_code.c infixtopostfix.c parsetree.c
  • ./main

To run the tests, which are an additional feature that comes with the code

  • gcc -o test unittests.c parsetree.c infixtopostfix.c
  • ./test
@TestSubjector
TestSubjector / Blockchain.jl
Last active April 13, 2021 13:16
A very basic implementation of a blockchain in Julia.
using SHA
using Dates
"""
An individual block structure
"""
struct Block
index::Int
timestamp::DateTime
data::String
previous_hash::String