This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
end | |
function getexponent(x::Float64) | |
rep = reinterpret(UInt64, x) | |
rawexp = ((rep & reinterpret(UInt64, Inf)) >> 52) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |