Skip to content

Instantly share code, notes, and snippets.

Avatar
📖
College

Anshul Singhvi asinghvi17

📖
College
View GitHub Profile
@asinghvi17
asinghvi17 / position_popup.jl
Created Aug 6, 2020
Makie position popup along multiple axes
View position_popup.jl
using Makie
using Makie.AbstractPlotting.MakieLayout
function position_popup!(
scene, axes;
formatter = (point::Point2f0) -> string(round.(Float64.(point), digits = 3)),
)
visible = Observable(false)
View tex_prototype.jl
# Generate the tex file
rawtex = raw"""
\documentclass{standalone}
\begin{document}
\[\left[{\frac{-\hbar^{2}}{2m}}\nabla^{2}+V(\mathbf{r})\right]\Psi(\mathbf{r}) = E\Psi(\mathbf{r})\] % Schrodinger equation
\end{document}
"""
lua_stdin = IOBuffer(writable = true)
View MakieUSPop.jl
# setup
# import Pkg;
# Pkg.pkg"add Makie#master PlotUtils GeoInterface GeoJSON"
using Makie
using GeoInterface, GeoJSON
using PlotUtils
states = download("https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json")
@asinghvi17
asinghvi17 / frequency_estimator.py
Created Jun 28, 2019 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
View frequency_estimator.py
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log, nonzero
from scipy.signal import blackmanharris, correlate
from time import time
import sys
try:
import soundfile as sf
except ImportError:
from scikits.audiolab import flacread
View interactive_lorenz.jl
## setup differential equation
using DifferentialEquations,
ParameterizedFunctions
lorenz = @ode_def Lorenz begin # define the system
dx = σ * (y - x)
dy = x *- z) - y
dz = x * y - β*z
end σ ρ β
View mass_prs.jl
#!/usr/bin/env julia
### USAGE
# GITHUB_AUTH="MY_GITHUB_AUTH_TOKEN_HERE" FILENAME.jl <per-package usage>
###
## NOTE:
# To set this up, you will need to change the two constants below
# to the user who will fork,
# and the organization which owns the repos.
@asinghvi17
asinghvi17 / mkprojects.jl
Last active May 1, 2019
Create Project.tomls for an entire organization's repos.
View mkprojects.jl
#!/usr/bin/env julia
### USAGE
# GITHUB_AUTH="MY_GITHUB_AUTH_TOKEN_HERE" mkproj.jl <packages names (WITH .jl)>...
###
## NOTE:
# To set this up, you will need to change the two constants below
# to the user who will fork,
# and the organization which owns the repos.
@asinghvi17
asinghvi17 / compile_packages.jl
Last active Mar 6, 2019
Compile your Julia packages while removing segfaults!
View compile_packages.jl
using PackageCompiler
pkgs = [:Makie, :AbstractPlotting, :StatsMakie, :GR, :DataFrames]
snoop, toml = PackageCompiler.snoop_packages(pkgs...)
nso, cso = PackageCompiler.compile_incremental(snoop, toml)
# do whatever here
@asinghvi17
asinghvi17 / gradasc.jl
Last active Feb 4, 2019
Julia interactive gradient ascent on a contour map (2D or 3D), can be changed to a heatmap (which is nice) or a surface (which has some bugs).
View gradasc.jl
##setup
# using Pkg
# pkg"add Makie ForwardDiff"
## begin program
using Makie,
ForwardDiff
# using MakieThemes
@asinghvi17
asinghvi17 / getting-julia
Last active Dec 23, 2018 — forked from benmarwick/getting-julia
install and build Julia in ubuntu
View getting-julia
#!/bin/bash
CWD=$(pwd)
DOWNDIRDIR="~/git" # modify as necessary for the directory you want to install Julia into
cd DOWNDIR # go to the download directory
git clone -b master git://github.com/JuliaLang/julia.git # clone the repo
# needed these on EC2
sudo apt-get update
sudo apt-get install gcc
You can’t perform that action at this time.