Skip to content

Instantly share code, notes, and snippets.

View ali-ramadhan's full-sized avatar

Ali Ramadhan ali-ramadhan

View GitHub Profile
@jkrumbiegel
jkrumbiegel / brain-vis.jl
Last active December 21, 2019 00:44
Makie brain viewer
using Makie
using MakieLayout
using NIfTI
nipath = "T1.nii.gz"
nidata = niread(nipath)
data = Float32.(nidata) ./ maximum(nidata)
function axhline!(la::LAxis, y::Node; kwargs...)
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@maleadt
maleadt / tdma.jl
Created June 6, 2019 22:20
Tridiagonal matrix algorithm on the GPU with Julia
# experimentation with batched tridiagonal solvers on the GPU for Oceananigans.jl
#
# - reference serial CPU implementation
# - batched GPU implementation using cuSPARSE (fastest)
# - batched GPU implementation based on the serial CPU implementation (slow but flexible)
# - parallel GPU implementation (potentially fast and flexible)
#
# see `test_batched` and `bench_batched`
using CUDAdrv
# Here I store more data as I go,
# which I could use to plot figures comparing methods
# the convergence speed of different methods
# I use the Rosenbrock classic example and
# Optim.jl as an iterative process which will
# call f multiple times to find its minimum
# and I plot the convergence vs time
using Optim, Cassette
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / cubed_sphere.py
Last active July 15, 2023 00:19
Cubed Sphere Mesh Generation and Plotting
from itertools import product
import numpy as np
INV_SQRT_3 = 1.0 / np.sqrt(3.0)
ASIN_INV_SQRT_3 = np.arcsin(INV_SQRT_3)
def gaussian_bell(xs, ys, xc=0., yc=0., xsigma=1., ysigma=1.):
""" Compute a 2D Gaussian with asymmetric standard deviations and