Skip to content

Instantly share code, notes, and snippets.

View MiCurry's full-sized avatar

Miles Curry MiCurry

View GitHub Profile
@MiCurry
MiCurry / add_cam_mpas_topo_atts.py
Created May 18, 2021 00:50
CAM-MPAS Topo Attributes
import os
import sys
import configparser
import argparse
from datetime import datetime
from netCDF4 import Dataset
# Add attributes to a topography file created by Peter's Topo Tool.
@shintakezou
shintakezou / counter2.f03
Created April 14, 2019 16:50
Nested functions in Fortran (2003, 2008…)
module counter2
implicit none
type element
character(len=16) :: s
integer :: e1, e2
end type element
contains
function count_unique(s) result(c)
@amarao
amarao / blame-praise.py
Last active June 14, 2024 16:59
Example of argparse with subparsers for python
#!/usr/bin/env python
import argparse
def main(command_line=None):
parser = argparse.ArgumentParser('Blame Praise app')
parser.add_argument(
'--debug',
action='store_true',
help='Print debug info'
@MiCurry
MiCurry / argParser.py
Last active April 16, 2024 19:14
ArgParser Example
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Easy way to produce plots of\
3D vector fields in python.')
parser.add_argument('task',
help='task name',
type=str)
parser.add_argument("-f", '--fileNameTag',
help='Appends it to the end of a filename so it can be unique when you plot it',
@haskaalo
haskaalo / tarcheatsheet.md
Last active July 12, 2024 06:35
Tar usage / Tar Cheat Sheet

Tar Usage / Cheat Sheet

Compress a file or directory

e.g: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: makes tar talk a lot. Verbose output shows you all the files being archived and much.
  • -f: Allows you to specify the filename of the archive.
@n-s-k
n-s-k / OOP_F2003_Part_2.md
Last active May 10, 2024 13:46
Object-Oriented Programming in Fortran 2003 Part 2: Data Polymorphism

Object-Oriented Programming in Fortran 2003 Part 2: Data Polymorphism

Original article by Mark Leair, PGI Compiler Engineer

Note: This article was revised in March 2015 and again in January 2016 to bring it up-to-date with the production software release and to correct errors in the examples.

This is Part 2 of a series of articles:

@n-s-k
n-s-k / OOP_F2003_Part_1.md
Last active May 10, 2024 13:46
Object-Oriented Programming in Fortran 2003 Part 1: Code Reusability
@oknowton
oknowton / zbell.zsh
Last active August 31, 2017 06:43 — forked from jpouellet/zbell.sh
#!/usr/bin/env zsh
# This script prints a bell character when a command finishes
# if it has been running for longer than $zbell_duration seconds.
# If there are programs that you know run long that you don't
# want to bell after, then add them to $zbell_ignore.
#
# This script uses only zsh builtins so its fast, there's no needless
# forking, and its only dependency is zsh and its standard modules
#