Skip to content

Instantly share code, notes, and snippets.

View rodonn's full-sized avatar

Rob Donnelly rodonn

View GitHub Profile
@jamesbrandecon
jamesbrandecon / FKRB.jl
Created November 24, 2023 20:03
A one-file implementation of Fox, Kim, Ryan, Bajari (2011)'s linear estimator for the mixed logit demand model, in the style of FRAC.jl and NPDemand.jl.
# This file contains a basic implementation of the FKRB estimator for the random coefficients logit model in Julia.
# In particular, it implements a constrained elastic net version of the estimator with aggregate data.
# -- Fox, Kim, Ryan, and Bajari (2011) https://onlinelibrary.wiley.com/doi/abs/10.3982/QE49
# Written by James Brand, 2023
# The main components of the code include:
# - The `logexpratio` function, which calculates market shares for a given parameter vector.
# - The `FKRBProblem` struct, which represents the FKRB problem and stores relevant data and results.
# - The `define_problem` function, which defines the FKRB problem based on input data and variables.
@neubig
neubig / dispatch_openai_requests.py
Last active February 19, 2024 17:55
A simple script to get results from the OpenAI Asynchronous API
# NOTE:
# You can find an updated, more robust and feature-rich implementation
# in Zeno Build
# - Zeno Build: https://github.com/zeno-ml/zeno-build/
# - Implementation: https://github.com/zeno-ml/zeno-build/blob/main/zeno_build/models/providers/openai_utils.py
import openai
import asyncio
from typing import Any
@grantmcdermott
grantmcdermott / bboot.R
Last active May 6, 2022 18:50
Bayesian bootstrap
# Context: https://twitter.com/grant_mcdermott/status/1487528757418102787
library(data.table)
library(fixest)
bboot =
function(object, reps = 100L, cluster = NULL, ...) {
fixest_obj = inherits(object, c('fixest', 'fixest_multi'))
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@b-
b- / !!
Last active October 20, 2022 14:35 — forked from cmlsharp/!!
# Add this to your ~/.config/fish/config.fish
# Syntax:
# To just rerun your last command, simply type '!!'
# This forked version supports "sudo !!" via two functions.
function !!
eval $history[1] $argv
end function
function sudo
if test $argv
@gizmaa
gizmaa / Plot_Examples.md
Last active April 12, 2024 14:18
Various Julia plotting examples using PyPlot