Skip to content

Instantly share code, notes, and snippets.

View acarril's full-sized avatar

Alvaro Carril acarril

View GitHub Profile
@acarril
acarril / init.lua
Created February 20, 2024 22:07
Global macOS hotkey for Kitty
-- Function: Center and focus the main window of an application
function centerAndFocusMainWindow(app)
local mainWindow = app:mainWindow()
if mainWindow then
mainWindow:centerOnScreen()
mainWindow:focus()
end
end
-- Function: Watch for a specific application launch and execute a callback when launched
@acarril
acarril / bootable-win-on-mac.md
Created November 18, 2022 17:49
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

@acarril
acarril / global-protect.md
Last active May 5, 2024 16:30
GlobalProtect toggle (start/quit)

Regain control over the annoying GlobalProtect macOS install

I need to use GlobalProtect because it's becoming the only VPN to access resources in my school. The VPN client is simple enough, but it does two annoying things:

  1. Registers itself to autostart on login
  2. Doesn't provide you with a simple 'quit' action

Here I'll show you how I fixed both issues in macOS 12.2 (Monterey).

image

@acarril
acarril / python-setup.md
Last active April 6, 2022 20:42
My Python setup (OSX)

My Python setup (OSX)

Lots of people (myself included) have been confused about how to go about installing Python on a new (or old) machine. This document is an attempt to maintain an up-to-date, succint guide on how to properly set up Python on macOS. It's 2021, so we'll focus on Python 3 here ffs.

The process is simple. Broadly speaking, my method boils down to

  1. installing Homebrew,
  2. installing pyenv using Homebrew, and
  3. installing one (or more) Python version(s) using pyenv

Yes, there are many more ways of doing this. Here we'll focus on my way, which is nevertheless based on careful testing and assesment of pros and cons of each method. See here or here for more details on available alternatives.

# ECO313 - Problem Set Solutions

ECO539B Homeworks

@acarril
acarril / 313_ps03_solution.Rmd
Last active March 2, 2021 16:05
313 - Problem Set solutions in R
---
title: "ECO313 - PS03"
author: "Álvaro Carril"
output:
pdf_document: default
html_document:
df_print: paged
---
This is my take on problem set 3, in R, for those who are curious about trying a ~~better~~ different tool.
@acarril
acarril / hw03.R
Last active February 24, 2021 13:24
ECO539B - Homework 3
setwd("/Users/alvaro/Dropbox/Princeton/2021-Spring/539B/03-IV/hw03")
### Load libraries
library(tidyverse)
library(haven) # import .dta
library(sandwich) # vcovHC()
library(clubSandwich) # vcovCR()
library(dfadjust)
library(progress)
library(brew)
@acarril
acarril / hw01.jl
Created February 10, 2021 19:37
ECO539B - Homework 1
using Random, Distributions
using ProgressMeter
using LaTeXTabulars, LaTeXStrings
Random.seed!(0303)
"""
Generate `M` simulation draws for `k` parameters for a design given by `θfactor`
Inputs:
- θfactor ... scalar with factor for θ_i (the "design")
@acarril
acarril / cmf_links_scraper.py
Created September 6, 2020 21:46
Scrape download links with CMF data (Comisión nacional para el Mercado Financiero, Chile)