Skip to content

Instantly share code, notes, and snippets.

View NoFishLikeIan's full-sized avatar
🦉
night owling

Andrea NoFishLikeIan

🦉
night owling
View GitHub Profile
@NoFishLikeIan
NoFishLikeIan / melbourne.csv
Created July 21, 2019 19:16
Mock time series
Date Temp
1981-01-01 20.7
1981-01-02 17.9
1981-01-03 18.8
1981-01-04 14.6
1981-01-05 15.8
1981-01-06 15.8
1981-01-07 15.8
1981-01-08 17.4
1981-01-09 21.8
@NoFishLikeIan
NoFishLikeIan / README.md
Created July 25, 2019 09:20
Intro to advanced types ts

Typescript for the young and free

Some "advanced" types

The backend returns some optional fields but you want to write a function that makes those optional fields nullable. Why? No apperent reason.

type Response = {
  name: string;
 age?: number;
@NoFishLikeIan
NoFishLikeIan / hw_template.tex
Last active September 14, 2019 16:48
Latex homework template
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
@NoFishLikeIan
NoFishLikeIan / assignment_4.ipynb
Last active April 1, 2020 21:25
Assignment_4.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NoFishLikeIan
NoFishLikeIan / log-normal-mc.jl
Last active November 9, 2020 07:26
Simulating the moments of a log normal AR process
using Distributions, Random, StatsBase
ρ = 0.7
σ = 1
μ = 0
σ_y = σ / √(1 - ρ^2)
N = 10_000_000
@NoFishLikeIan
NoFishLikeIan / ch_plot.jl
Created November 9, 2020 09:04
Plot chebyshev polynomials
function U(n, x)
if n == 0 return 0 end
if n == 1 return x end
return 2 * x * U(n - 1, x) - U(n - 2, x)
end
space = collect(range(0, 1, length=200))
plot(dpi=1000, legend=false, xaxis=false, yaxis=false, ticks=false)
# Author: Gabriela Miyazato Szini and Andrea Titton - March 2021
import numpy as np
from itertools import permutations, combinations
np.random.seed(110792)
verbose = True
# Initialization
@NoFishLikeIan
NoFishLikeIan / annotatewithbox.jl
Created July 26, 2021 17:19
Put box around annotate in Plots.jl
function annotatewithbox!(
fig::Plots.Plot,
text::Plots.PlotText,
x::Real, y::Real, Δx::Real, Δy::Real = Δx;
kwargs...)
box = Plots.Shape(:rect)
Plots.scale!(box, Δx, Δy)
Plots.translate!(box, x, y)
@NoFishLikeIan
NoFishLikeIan / longestitword.jl
Created August 19, 2021 13:46
Find "longest" Italian word!
using DelimitedFiles, Base.Iterators
alphabet = 'A':'Z'
n = length(alphabet)
alphabetdict = Dict(alphabet .=> 1:n)
function parsepair(str::String)
clean = strip(str, [' ', '|'])
l, r = only.(split(clean, ""))
@NoFishLikeIan
NoFishLikeIan / plotvectorfield.jl
Last active December 11, 2023 10:55
Small routine to plot vector fields
begin
function plotvectorfield(xs, ys, g::Function; plotkwargs...)
fig = plot()
plotvectorfield!(fig, xs, ys, g; plotkwargs...)
return fig
end
function plotvectorfield!(figure, xs, ys, g::Function; rescale = 1, plotkwargs...)
xlims = extrema(xs)