Skip to content

Instantly share code, notes, and snippets.

Avatar

Venkatesh-Prasad Ranganath rvprasad

View GitHub Profile
@rvprasad
rvprasad / test_process.py
Last active Oct 20, 2017
Illustrates how the performance of multiprocessing.Process changes inside and outside of multiprocessing.Pool in Python.
View test_process.py
# Python -- v3.6
import begin
import multiprocessing
import time
def worker(varying_data, fixed_data):
t = 0
for j in range(1, 10000):
@rvprasad
rvprasad / test_process_graph.gp
Created Oct 20, 2017
Creates the graph from the data generated by test_process.py.
View test_process_graph.gp
set terminal png
set output "test_process.png"
set logscale
set xlabel "Size of fixed data [Number of ints]"
set ylabel "Performance [seconds per iteration]"
set title "Performance of options vs Size of fixed data"
plot "test_process.csv" using 1:2 title "builtin pool" with linespoints, \
"test_process.csv" using 1:3 title "custom pool" with linespoints
@rvprasad
rvprasad / test_pool_map_graph.gp
Created Oct 21, 2017
creates the graph from the data generated by test_pool_map.py.
View test_pool_map_graph.gp
set terminal png
set output "test_pool_map.png"
set logscale
set xlabel "Size of aux data [Number of ints]"
set ylabel "Performance [seconds per iteration]"
set title "Performance of options vs Size of aux data"
plot "test_pool_map.csv" using 1:2 title "without initializer / default chunksize" with linespoints, \
"test_pool_map.csv" using 1:3 title "with initializer / default chunksize" with linespoints, \
"test_pool_map.csv" using 1:4 title "without initializer / 250 chunksize" with linespoints, \
"test_pool_map.csv" using 1:5 title "with initializer / 250 chunksize" with linespoints, \
@rvprasad
rvprasad / testClosuresAndClasses.groovy
Last active Oct 21, 2017
Illustrates when Java's method resolution is not honored in Groovy.
View testClosuresAndClasses.groovy
class A {
protected foo() {
this.bar("Site foo1")
def x = {
println("This: ${this.class}")
this.bar("Site foo2")
}
x()
}
@rvprasad
rvprasad / build.gradle
Last active Mar 12, 2018
(Ghera) Automating multi-app functional testing against different versions of Android
View build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
@rvprasad
rvprasad / config.txt
Last active Dec 19, 2019
Configure a Raspberry Pi cluster using cloud-init and then install few packages
View config.txt
hdmi_safe=1
enable_uart=0
gpu_mem=16
@rvprasad
rvprasad / 3NumSorter.groovy
Last active Apr 11, 2018
Sorts three numbers by encoding the sorting problem as a SAT problem
View 3NumSorter.groovy
/*
* Copyright (c) 2018, Venkatesh-Prasad Ranganath
*
* Licensed under BSD 3-clause License
*
* Author: Venkatesh-Prasad Ranganath
*/
// Sorts three numbers using SAT solving
// Script uses z3 solver (https://github.com/Z3Prover/z3)
@rvprasad
rvprasad / simpleSudokuSolver.groovy
Last active Apr 14, 2018
Solves a simplified version of sudoku (w/ only row and column constraints) using z3 SAT solver
View simpleSudokuSolver.groovy
/*
* Copyright (c) 2018, Venkatesh-Prasad Ranganath
*
* Licensed under BSD 3-clause License
*
* Author: Venkatesh-Prasad Ranganath
*/
// Solves a simplified version of sudoku (w/ only row and column constraints)
// using SAT solving
@rvprasad
rvprasad / bfsSolver.groovy
Created Apr 15, 2018
Identifies a BFS traversal order of nodes of a given directed graph using z3 solver
View bfsSolver.groovy
/*
* Copyright (c) 2018, Venkatesh-Prasad Ranganath
*
* Licensed under BSD 3-clause License
*
* Author: Venkatesh-Prasad Ranganath
*/
import groovy.transform.Field
@rvprasad
rvprasad / dfsSolver.groovy
Last active Apr 16, 2018
Identifies a DFS traversal order of nodes of a given directed graph using z3 solver
View dfsSolver.groovy
/*
* Copyright (c) 2018, Venkatesh-Prasad Ranganath
*
* Licensed under BSD 3-clause License
*
* Author: Venkatesh-Prasad Ranganath
*/
import groovy.transform.Field