Skip to content

Instantly share code, notes, and snippets.

View asinghvi17's full-sized avatar
🔍

Anshul Singhvi asinghvi17

🔍
  • Columbia University
  • New York, NY
View GitHub Profile
@jkrumbiegel
jkrumbiegel / distance_grid.jl
Created January 31, 2020 17:34
get a grid of distances and durations between one location and a grid of locations
using HTTP
using Dates
using Printf
using JSON
using DataFrames
using CSV
hbf_location = "53.5527704,10.0065856"
AMDGPUnative => ["ROCArrays"]
AbstractAlgebra => ["Ccluster", "IntegerTriangles"]
AbstractMCMC => ["Turing"]
AbstractTrees => ["PDFIO", "PhysOcean"]
ApproxFun => ["EffectiveWaves", "PDSampler"]
ApproxFunBase => ["ApproxFunRational", "Poltergeist", "RiemannHilbert"]
ApproxFunFourier => ["ApproxFunRational"]
ApproxFunOrthogonalPolynomials => ["ApproxFunRational"]
ArgCheck => ["ANOVA", "AltDistributions", "BAT", "ContinuousTransformations", "DarkSky", "FunctionalTables", "GoogleMaps", "HMMBase", "MultistartOptimization", "PolynomialBases", "SimpleIntegrals", "SortedVectors", "SpectralKit", "StataDTAFiles", "TransformVariables"]
using Makie
using AbstractPlotting
scene = Scene()
scene = mesh(Sphere(Point3f0(0), 0.9f0), transparency=true, alpha=0.05)
function cosine_weighted_sample_hemisphere()
r1 = rand()
using Makie
using AbstractPlotting
using FileIO, Colors
# Load World Ocean Atlas 2D fields for PO₄, Si(OH)₄, and NO₄
using WorldOceanAtlasTools
lat, lon, PO₄_2D = WorldOceanAtlasTools.WOA13_surface_map("p", 0, "1°")
lat, lon, NO₄_2D = WorldOceanAtlasTools.WOA13_surface_map("n", 0, "1°")
lat, lon, SiOH₄_2D = WorldOceanAtlasTools.WOA13_surface_map("i", 0, "1°")
# Add the image layer to each plot
@mrkpatchaa
mrkpatchaa / README.md
Last active June 6, 2024 21:03
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@mie00
mie00 / download.py
Created July 1, 2014 13:30
pdf free books
# -*- coding: utf-8 -*-
import re
import urllib
from multiprocessing import Pool
import requests
import progressbar
CHUNK_SIZE = 1024 * 1024 # 1MB
def download(i):
@jbenet
jbenet / tikz2svg
Last active November 30, 2022 04:34
tikz2svg - convert tikz input into svg
#!/usr/bin/env python
#
# author: github.com/jbenet
# license: MIT
#
# tikz2svg: convert tikz input into svg
# depends on:
# - pdflatex: comes with your tex dist
# - pdf2svg: brew install pdf2svg
@MikeInnes
MikeInnes / startup.jl
Last active February 5, 2023 12:54
Some useful macros for Julia
# Repeat an operation n times, e.g.
# @dotimes 100 println("hi")
macro dotimes(n, body)
quote
for i = 1:$(esc(n))
$(esc(body))
end
end
end
@endolith
endolith / frequency_estimator.py
Last active May 8, 2024 17:59
Frequency estimation methods in Python
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