Skip to content

Instantly share code, notes, and snippets.

View manodeep's full-sized avatar
👋

Manodeep Sinha manodeep

👋
View GitHub Profile
@manodeep
manodeep / replace-cdir-directives-with-dir-directives.sh
Created July 22, 2025 05:17
Code to replace (known + feasible) !CDIR compiler directives to the equivalent !DIR$ directives
#!/bin/bash
## Taken from https://stackoverflow.com/a/28044986
# 1. Create ProgressBar function
# 1.1 Input is currentState($1) and totalState($2)
function ProgressBar {
# Check if output is going to a tty
if [ -t 1 ]; then
# Output progress bar only if output is to tty
@manodeep
manodeep / decompile-binaries.sh
Last active June 2, 2025 00:40
Harshula's bash script to decompile binaries
#!/bin/bash
# Copyright (C) 2023 Harshula Jayasuriya
# https://gitlab.com/harshula/tools/decompile-binaries.sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@manodeep
manodeep / valgrind_filter.py
Created May 19, 2025 03:59
A python code to filter out (gadi-specific) MPI library errors reported by valgrind
#!/usr/bin/env python
# Written by Manodeep Sinha, May 2025 to filter out valgrind error logs.
# Regex idea extended from https://stackoverflow.com/a/34407168
# Untested. Use at your own risk. - Manodeep Sinha, May 19, 2025
import fileinput
import re
@manodeep
manodeep / aps_report_20250415_102000--esm1.6-dev_2025.04.html
Created April 16, 2025 03:57
`APS` output for 208 cores for the latest AMIP release
<!DOCTYPE html><html lang="en"><head><title>APS report</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">@-webkit-keyframes filler{0%{width:0}}@-moz-keyframes filler{0%{width:0}}@keyframes filler{0%{width:0}}.icon[data-v-03c6e8ae]:after,.icon[data-v-03c6e8ae]:before{display:inline-block;width:1em;height:1em;line-height:1em;vertical-align:middle}.icon.menu[data-v-03c6e8ae]:after{content:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23fff"><path d="M3 3h14v3H3zM3 13h14v3H3zM3 8h14v3H3z"/></svg>')}.icon.comments[data-v-03c6e8ae]:after{content:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23fff"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 9h1.25C18.44 9 19 8.44 19 7.75v-6.5C19 .56 18.44 0 17.75 0h-8.5C8.56 0 8 .56 8 1.25v6.5C8 8.44 8.56 9 9.25 9H14l2.5 2.5V9zm-1.982-1.5H9.5v-6h8v6h-2.25v.732l-.732-.732z"/><path d="M2.25 4H7v1.5H2.5v6h2.25v.
@manodeep
manodeep / check_for_repro_multi_dirs.sh
Last active June 20, 2025 05:22
Checking for reproducible atmosphere results between two experiments
#!/usr/bin/env bash
## Written by Manodeep Sinha (ACCESS-NRI, ANU) March 2025
## Has made use of https://www.shellcheck.net/ to identify potential errors
## in the script. Other code fragments taken out of Stackoverflow and alike sites
## are noted inline.
## LICENSE: MIT
echo "Setting up colors and font-styles ..."
@manodeep
manodeep / Timings.py
Last active August 10, 2023 04:11 — forked from synapticarbors/Timings.py
Attempt to create a faster version of a Euclidean pairwise distance method in cython using BLAS. Strategy for including BLAS taken from the Tokyo project.
import numpy as np
from scipy.spatial.distance import cdist
from distlib import pairwise_cython_blas, pairwise_cython, pairwise_cython_blas2
import timeit
a = np.random.random(size=(10000,3))
loop = 1
repeat = 1
funcs = ['cdist(a,a)', 'pairwise_cython(a)', 'pairwise_cython_blas(a)', 'pairwise_cython_blas2(a)']
@manodeep
manodeep / compute_joint_wp_and_gmf_correlation_matrix_from_theory_with_ngal_from_mocks.pro
Created November 8, 2021 04:54
IDL code to create the enormous correlation matrix plot from Sinha et al 2018
function return_left_edge, axis, index, value
common tick_block, fixed_value_left_x, fixed_value_right_x
if value lt n_elements(fixed_value_left_x) then begin
tickmark = string_logexp(fixed_value_left_x[value])
endif else begin
if value eq n_elements(fixed_right_x) then begin
tickmark = string_logexp(fixed_value_right_x[-1])
endif else begin
tickmark = 'N!Dgal!N'
endelse
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manodeep
manodeep / Compiling + output
Last active March 30, 2020 04:58
Code to find next highest power of 2
[~/temp/astropy-64bit-power-of-2 @Manodeeps-MacBook-Pro] gcc -std=gnu11 -O2 -Wall -Wextra test.c
test.c: In function 'naive_p2':
test.c:227:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(result < n) {
^
[~/temp/astropy-64bit-power-of-2 @Manodeeps-MacBook-Pro] ./a.out
Running in 64 bit mode
Checking overflow bug
nbytes = 9223372036854775807 nextp2 = -9223372036854775808 (unsigned) nextp2 = 9223372036854775808
nbytes = -1 nextp2 = 1 (unsigned) nextp2 = 1
@manodeep
manodeep / h5_dtype_sizes.c
Created November 20, 2019 06:31
Getting size (in bytes) for some of the common HDF5 native datatypes
/* A code to print out the data size (in bytes) corresponding to the
common HDF5 native datatypes
Author: Manodeep Sinha
Date: 20/11/2019
Compile with `