Skip to content

Instantly share code, notes, and snippets.

Avatar
👾
👽🛸🌍🔥💀

Tim DuBois Libbum

👾
👽🛸🌍🔥💀
View GitHub Profile
@Libbum
Libbum / rössler_uode.jl
Created Oct 28, 2020
A universal ODE implementation of a Rössler Attractor
View rössler_uode.jl
using OrdinaryDiffEq
using ModelingToolkit
using DataDrivenDiffEq
using LinearAlgebra
using DiffEqSensitivity
using Optim
using Flux
using DiffEqFlux
using Plots
View PKGBUILD.Asl
# 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 Aug 20, 2019
Problem with fixing a value vs constraining a value
View fixtest.jl
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 Feb 28, 2019
Julia 1.1 / JuMP 0.19 Parameter issue
View dice2016Rbeta.jl
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 Feb 26, 2019
Compare Julia 0.64 / JuMP 0.17 to Julia 1.1 / JuMP 0.18
View dice2016Rbeta.jl
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 Mar 13, 2018
Outputs current layout for the keyboard
View getxkblayout.c
#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 Mar 13, 2018
`gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile`
View getxkblayout.c
#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 Mar 11, 2018
rustup-dummy
View PKGBUILD
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 Jan 8, 2018
Binomial Coefficient
View nchoosek.rs
/// 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
World tour of Tiny Countries
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
}
.fill {
fill: #fff;
}