Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View singularitti's full-sized avatar
:octocat:
WFH

Qi Zhang singularitti

:octocat:
WFH
View GitHub Profile
@singularitti
singularitti / seam_carving.jl
Last active July 8, 2022 05:54 — forked from ricebunnyNL/seam_carving.jl
Optimized seam carving for Julia
function find_min_energy_map2(energy)
energy = transpose(energy)
row, col = size(energy)
dir_arr = [-1, 0, 1]
energy_map = zeros(row, col)
energy_map[:, end] = energy[:, end]
dirs = zeros(Int, row, col)
@inbounds for c = col-1:-1:1
@singularitti
singularitti / enum-vs-dispatch.jl
Last active April 20, 2020 02:34 — forked from felipenoris/enum-vs-dispatch.jl
Benchmark of dispatch on enum types and types #Julia #benchmark
using Test
using BenchmarkTools
@enum ECompoundingType EContinuous = 1 ESimple = 2 EExponential = 3
abstract type TCompoundType end
struct TContinuous <: TCompoundType end
struct TSimple <: TCompoundType end
struct TExponential <: TCompoundType end
@singularitti
singularitti / update_git_repos.sh
Last active February 28, 2020 00:38 — forked from douglas/update_git_repos.sh
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
printf '\n\033[1mPulling in latest changes for all repositories...\033[0m\n'
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
#!/usr/bin/python
"""
Parses Fortran Namelists
based on Fortran Namelist parser for Python prog/scripts by Stephane Chamberland (stephane.chamberland@ec.gc.ca)
http://code.google.com/p/fortran-namelist/
Updated by Volodymyr Vladymyrov (http://stackoverflow.com/users/1296661/vvladymyrov) to parse format presented
in http://stackoverflow.com/questions/14165733/regular-expression-parsing-key-value-pairs-in-namelist-input-file
added support for
1)
$NAMELIST