Skip to content

Instantly share code, notes, and snippets.

View Libbum's full-sized avatar
👾
👽🛸 ➤ 🌍🔥💀

Tim DuBois Libbum

👾
👽🛸 ➤ 🌍🔥💀
View GitHub Profile
@Libbum
Libbum / rössler_uode.jl
Created October 28, 2020 13:15
A universal ODE implementation of a Rössler Attractor
using OrdinaryDiffEq
using ModelingToolkit
using DataDrivenDiffEq
using LinearAlgebra
using DiffEqSensitivity
using Optim
using Flux
using DiffEqFlux
using Plots
@Libbum
Libbum / PKGBUILD.Asl
Created November 28, 2019 10:36
Ipopt 3.13.0
# ASL
pkgname=coinasl
pkgver=1.4.1
pkgrel=1
pkgdesc="COIN-OR autotools harness to build AMPL Solver Library"
arch=('i686' 'x86_64')
url="https://github.com/coin-or-tools/ThirdParty-ASL/"
#license=('')
groups=('coin-or')
@Libbum
Libbum / fixtest.jl
Last active August 20, 2019 10:06
Problem with fixing a value vs constraining a value
using JuMP
using Ipopt
const N = 60; #Number of years to calculate (from 2010 onwards)
const tstep = 5; #Years per Period
const ρ = 0.015; #Initial rate of social time preference per year
const θ₂ = 2.8; #Exponent of control cost function
#vvv Currently twitchy when changing out this scale value vvv
const scale = 5/3.666;
@Libbum
Libbum / dice2016Rbeta.jl
Last active February 28, 2019 10:24
Julia 1.1 / JuMP 0.19 Parameter issue
using JuMP
using Ipopt
N = 100 #Number of years to calculate (from 2015 onwards)
tstep = 5 #Years per Period
α = 1.45 #Elasticity of marginal utility of consumption
ρ = 0.015 #Initial rate of social time preference per year ρ
γₑ = 0.3 #Capital elasticity in production function
pop₀ = 7403 #Initial world population 2015 (millions)
popadj = 0.134 #Growth rate to calibrate to 2050 pop projection
@Libbum
Libbum / dice2016Rbeta.jl
Last active February 26, 2019 14:28
Compare Julia 0.64 / JuMP 0.17 to Julia 1.1 / JuMP 0.18
using JuMP
using Ipopt
N = 100 #Number of years to calculate (from 2015 onwards)
tstep = 5 #Years per Period
α = 1.45 #Elasticity of marginal utility of consumption
ρ = 0.015 #Initial rate of social time preference per year ρ
γₑ = 0.3 #Capital elasticity in production function
pop₀ = 7403 #Initial world population 2015 (millions)
popadj = 0.134 #Growth rate to calibrate to 2050 pop projection
@Libbum
Libbum / getxkblayout.c
Last active March 13, 2018 11:31
Outputs current layout for the keyboard
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
@Libbum
Libbum / getxkblayout.c
Created March 13, 2018 11:30
`gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
@Libbum
Libbum / PKGBUILD
Created March 11, 2018 16:48
rustup-dummy
pkgname=rustup-dummy
pkgver=0.0.1
pkgrel=1
pkgdesc='Makes pacman think that rustup, rust, and cargo are installed. (For users who installed via rustup.rs)'
arch=('any')
license=('custom:CC0')
provides=('cargo' 'rust' 'rustup')
source=('https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt')
md5sums=('65d3616852dbf7b1a6d4b53b00626032')
@Libbum
Libbum / nchoosek.rs
Created January 8, 2018 10:04
Binomial Coefficient
/// Calculate the number of combinations when choosing k values from n elements.
fn nchoosek(n: u64, k: u64, scale: f64) -> f64 {
if k > n {
0.0
} else if k == 0 || k == 1 {
1.0
} else {
let mut comb = 1.0;
for j in 0..cmp::min(k, n - k) {
comb /= (j + 1) as f64;
@Libbum
Libbum / index.html
Created May 8, 2016 08:28
World tour of Tiny Countries
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
}
.fill {
fill: #fff;
}