Skip to content

Instantly share code, notes, and snippets.

View fivejjs's full-sized avatar
🏠
Working from home

vfive fivejjs

🏠
Working from home
  • Data scientist and engineer
  • Sydney Australia
View GitHub Profile
@fivejjs
fivejjs / dijkstra.clj
Created December 18, 2021 11:13 — forked from loganlinn/dijkstra.clj
Dijkstra's Algorithm in Clojure
(def ^:private inf (Long/MAX_VALUE))
(defn neighbors
"Returns n's neighbors, optionally filtered if unvisited"
([g n] (get g n {}))
([g n uv] (select-keys (neighbors g n) uv)))
(defn update-costs
"Returns costs updated with any shorter paths found to curr's unvisisted
neighbors by using curr's shortest path"
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import missingno
import warnings
warnings.filterwarnings("ignore")
%matplotlib inline
@fivejjs
fivejjs / countries_codes_and_coordinates.csv
Created August 16, 2021 23:27 — forked from tadast/countries_codes_and_coordinates.csv
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude coordinates
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
Antigua and Barbuda AG ATG 28 17.05 -61.8
@fivejjs
fivejjs / gist:08b6299be5dd2c6f428b68f0e4d6bc96
Created April 30, 2021 12:09 — forked from bcherny/gist:de24955c15430efd99f1
How to squash commits with git

Let's say you have a Pull Request from myBranch to master with 3 commits, and you want them to appear as a single commit in master.

If you're merging on the command line, this is trivial:

git checkout master
git merge --squash myBranch
git commit
@fivejjs
fivejjs / crop_mask_feature_layer.py
Created February 15, 2021 07:53 — forked from cbur24/crop_mask_feature_layer.py
Feature layer function for production run of eastern crop-mask
def gm_mads_two_seasons(ds1, ds2):
"""
Feature layer function for production run of
eastern crop-mask
"""
def fun(ds, era):
#normalise SR and edev bands
for band in ds.data_vars:
if band not in ['sdev', 'bcdev']:
ds[band] = ds[band] / 10000
@fivejjs
fivejjs / librosa_parallel.py
Created December 12, 2019 23:04 — forked from tracek/librosa_parallel.py
Running librosa parallel for loops with multiprocessing and joblib
# The script illustartes stunning difference on my machine with processing of signal with multiprocessing and joblib.
# The slowness of multiprocessing is likely caused by oversubscription
import time
import numpy as np
import librosa
from joblib import Parallel, delayed
from functools import partial
from multiprocessing import Pool
@fivejjs
fivejjs / 1.html.md
Created November 3, 2019 10:51 — forked from hongyangqin/1.html.md
傅立叶变换的物理意义 From:https://mp.weixin.qq.com/s/B0267BKDutJhUQ5I9wquqg##

傅立叶变换的物理意义

原创 2016-04-08 yangboy2

昨天我们分享了一篇《FFT结果的物理意义》一文,有些网友表示看不大明白,为此我们整理重发一篇去年分享过的《傅里叶变换的物理意义》一文,以便大家更好的理解。

1. 先看下面的两幅动画,增加对傅立叶变换的印象

@fivejjs
fivejjs / 1.html.md
Created November 3, 2019 10:51 — forked from hongyangqin/1.html.md
傅立叶变换的物理意义 From:https://mp.weixin.qq.com/s/B0267BKDutJhUQ5I9wquqg##

傅立叶变换的物理意义

原创 2016-04-08 yangboy2

昨天我们分享了一篇《FFT结果的物理意义》一文,有些网友表示看不大明白,为此我们整理重发一篇去年分享过的《傅里叶变换的物理意义》一文,以便大家更好的理解。

1. 先看下面的两幅动画,增加对傅立叶变换的印象

@fivejjs
fivejjs / docker-cheat-sheat.md
Created May 9, 2019 02:00 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@fivejjs
fivejjs / tmux-cheatsheet.markdown
Created January 6, 2018 01:36 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname