Skip to content

Instantly share code, notes, and snippets.


Nishanth H. Kottary nkottary

  • Julia Computing, Inc.
  • Bangalore, India
View GitHub Profile
View matches.jl
str = "mangoicecream"
options = ["man", "ice", "cream", "go", "icecream", "mango"]
# prints the answer
function domatch(str, options, acc = [])
for op in options
cacc = copy(acc)
if length(op) <= length(str) && str[1:length(op)] == op
push!(cacc, op)
if length(op) == length(str)
nkottary / video_script.txt
Created Nov 13, 2018
Script for apps video
View video_script.txt
0:06 = Hello, in this video we will see how to create apps on JuliaBox
0:23 = Click on the "Launch" button to start Jupyter
0:37 = Now we go back to the dashboard and open up the "My Apps" tool
0:42 = The default values describe a built-in example app that you can run. Just hit "Deploy"
1:03 = Now you should see the app on the dashboard. Click on the "Short Link" to connect to the app. This link can also be shared with o
ther users.
1:13 = Lets wait for the app to start up. This app accepts some code on the left box and runs it when you click the button. The results
are on the right.
1:34 = Now lets see the julia code for this app
1:46 = First we copy the file from the default location to our home so that Jupyter can see it.
View leaky.jl
const PID = getpid()
const command = "ps -p $PID -o vsz | sed -n 2p"
const NUM_ITER = 10000
const NUM_PRINT = div(NUM_ITER, 10)
# Get virtual memory usage from julia
jvsz() = split(readall(`ps -p $PID -o vsz`),"\n")[2]
# Get virtual memory usage from C
function cvsz()
View msgtest.c
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <stdint.h>
#include <zmq.h>
/* Look for leaks in while repeatedly sending messages
Compile like this: gcc -I/usr/local/include msgtest.c -L/usr/local/lib -lzmq -g -o mt
View bindtest.c
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include "zmq.h"
#include <string.h>
/* Look for leaks when repeatedly binding.
Compile like this: gcc -I/usr/local/include bindtest.c -L/usr/local/lib -lzmq -g -o bt
nkottary / test.jl
Created Feb 22, 2016
ODBC jq/remodel branch testing for various database backends
View test.jl
using ODBC
using DataFrames
@linux_only const TEMP_FILE = "/tmp/tmp.csv"
@windows_only const TEMP_FILE = "tmp.csv"
const MYSQL_DSN = "UbuntuMySQL"
const MSSQL_DSN = "MSSQL_Server"
function test_mysql()
nkottary / fix.jl
Created Nov 27, 2015
My fix for number test failure on ARM.
View fix.jl
function getexponent(x::Float32)
rep = reinterpret(UInt32, x)
rawexp = ((rep & reinterpret(UInt32, Float32(Inf))) >> 23)
exp = convert(Int, rawexp) - 127 # 127 is bias
return exp
function getexponent(x::Float64)
rep = reinterpret(UInt64, x)
rawexp = ((rep & reinterpret(UInt64, Inf)) >> 52)