Skip to content

Instantly share code, notes, and snippets.

View jimtalksdata's full-sized avatar
🤓

jimtalksdata

🤓
View GitHub Profile
@jimtalksdata
jimtalksdata / dcf.py
Last active May 23, 2023 20:08
gold_etf_question
import numpy as np
def calculate_etf_value(discount_rate, gold_return, years_to_discard, future_year, simulations=10000):
# Initialize a list to store the present values from each simulation
present_values = []
# For each simulation...
for _ in range(simulations):
# Randomly select a year for the gold to be discarded
discard_year = np.random.uniform(0, years_to_discard)

Keybase proof

I hereby claim:

  • I am jimtalksdata on github.
  • I am jtd (https://keybase.io/jtd) on keybase.
  • I have a public key ASBiWZ2xiu63pIdZY2wyuzWT6az5K1krATJ26Eyc6hfVIgo

To claim this, I am signing this object:

@jimtalksdata
jimtalksdata / wireguard.sh
Created December 15, 2018 17:03
Ubuntu / wireguard setup
# Add the WireGuard repository:
sudo add-apt-repository ppa:wireguard/wireguard
# Update the list of available packages (not necessary on Bionic):
sudo apt update
# Install the tools and kernel module:
sudo apt install wireguard
# Install the config file to the WireGuard configuration directory on your
@jimtalksdata
jimtalksdata / sshd_config
Created December 15, 2018 17:02
Default sshd_config with no password authentication
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@jimtalksdata
jimtalksdata / sshd_pass_patch2.txt
Last active December 15, 2018 17:01
Patches default password authentication to no on AlphaRacks
--- /etc/ssh/sshd_config 2016-06-21 11:28:46.000000000 -0400
+++ sshd_config 2018-12-13 23:00:00.494884324 -0500
@@ -50,6 +50,7 @@
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
+PasswordAuthentication no
# Kerberos options
#KerberosAuthentication no
@jimtalksdata
jimtalksdata / sshd_pass_patch.txt
Created December 15, 2018 17:00
Patches password authentication to no on default Hetzner Ubuntu 16.04
--- /etc/ssh/sshd_config 2018-09-24 12:25:35.136821000 +0200
+++ /root/sshd_config 2018-12-14 04:42:23.889907193 +0100
@@ -53,6 +53,7 @@
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
+PasswordAuthentication no
#PasswordAuthentication yes
#PermitEmptyPasswords no
@jimtalksdata
jimtalksdata / Keybase.md
Created July 10, 2018 12:53
Keybase.md

Keybase proof

I hereby claim:

  • I am jimhsu on github.
  • I am jtd (https://keybase.io/jtd) on keybase.
  • I have a public key whose fingerprint is F500 F270 E8D5 7D97 BDC6 BF1A A3FB 5E4E 1999 46DC

To claim this, I am signing this object:

@jimtalksdata
jimtalksdata / TwitterExporter.gs
Created March 14, 2018 23:19
Google Sheets - Twitter Export 3.2.3
// Copyright 2014 Martin Hawksey. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@jimtalksdata
jimtalksdata / ImportJSON.gs
Created March 14, 2018 23:18
Google sheets - ImportJSON
/*====================================================================================================================================*
ImportJSON by Brad Jasper and Trevor Lohrbeer
====================================================================================================================================
Version: 1.4.0
Project Page: https://github.com/bradjasper/ImportJSON
Copyright: (c) 2017 by Brad Jasper
(c) 2012-2017 by Trevor Lohrbeer
License: GNU General Public License, version 3 (GPL-3.0)
http://www.opensource.org/licenses/gpl-3.0.html
------------------------------------------------------------------------------------------------------------------------------------
@jimtalksdata
jimtalksdata / RefreshImports.gs
Created March 14, 2018 23:17
Google sheets - RefreshImports
/**
* Go through all sheets in a spreadsheet, identify and remove all spreadsheet
* import functions, then replace them a while later. This causes a "refresh"
* of the "import" functions. For periodic refresh of these formulas, set this
* function up as a time-based trigger.
*
* Caution: Formula changes made to the spreadsheet by other scripts or users
* during the refresh period COULD BE OVERWRITTEN.
*
* From: https://stackoverflow.com/a/33875957/1677912