{{ message }}

Instantly share code, notes, and snippets.

# mbeltagy

Created Nov 9, 2019
Pascal Triangle calculation
View pascal.jl
 "Pascal triangle" function pascal(n) (n<=0) && error("Pascal trinalge can not have zero or negative rows") r=Vector{Int}(undef,n) pr=Vector{Int}(undef,n) pr[1]=r[1]=1 println(@view pr[1]) for i=2:n r[1]=r[i]=1 for j=2:i-1
Created Jun 1, 2019
Julia rounding up or down to the nearest integer mulitple
View roundupdown.jl
 round_up(x,m::Integer)=ceil(Int,x/m).*m round_down(x,m::Integer)=floor(Int,x/m).*m
Last active Feb 14, 2019
Interpolations Example
View Interpolation_example.jl
 using Interpolations, Plots # Demonstrating interpolations x=0:0.5:2π y=sin.(x); itp=LinearInterpolation(x,y); y2=[itp(x) for x in 0:0.1:2]; x2=0:0.1:6; y2=[itp(x) for x in x2]; itpC=CubicSplineInterpolation(x,y);
Created Feb 10, 2019
Building Expenses Filtration
 using CSV data=CSV.read("Jan19.csv") # The occursin is used to get the line where the transfer happened...hence summing all transfers audi_ind=findall(x->ismissing(x) ? false : occursin(r"audi"i,x), data[:,1]) data[audi_ind,1:3][:Cash] |> x-> prod.(split.(x,',')) |> x-> Meta.parse.(x) |> sum
Last active Nov 26, 2017
Getting TensorFlow.jl to build properly
View extractcerts.jl
 #= I was getting the following errors when running Pkg.update("TensorFlow") On my ubunutu 14.04 INFO: Building TensorFlow.jl for CPU use only. To enable the GPU, set the TF_USE_GPU environment variable to 1 and rebuild TensorFlow.jl % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Created Jul 15, 2017
Opening up fusion table from Julia
 # Reading a fusion table from Julia using Requests, DataFrames request_url = "https://www.googleapis.com/fusiontables/v2/query" query = "SELECT * FROM 1KlX4PFF81wlx_TJ4zGudN_NoV_gq_GwrxuVau_M" resp=get(request_url,query=Dict("sql"=>query, "key"=>"somekey","alt"=>"csv")) myTable=readtable(IOBuffer(resp.data));
Last active Jun 23, 2017
Jumping from second floor to pool
View PoolJumpCalc.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Jun 7, 2017
Tupper's_self-referential_formula in Julia
View TupperFormula.ipynb