Skip to content

Instantly share code, notes, and snippets.

View alastairparagas's full-sized avatar

Alastair Paragas alastairparagas

View GitHub Profile
@alastairparagas
alastairparagas / bonds.py
Last active September 16, 2022 15:06
Treasury, TIPS and I-bonds: Playing with bonds
import numpy as np
import matplotlib.pyplot as plt
np.seterr(all="ignore")
import matplotlib.ticker as ticker
import numpy_financial
# Treasury, TIPS and I-bonds - these are all bonds, which allows you to lend
# a $ amount (principal) to the US government. The US government promises to pay
# you back in time (years).
@alastairparagas
alastairparagas / capital.py
Created September 3, 2022 01:01
Car purchase: Auto Loan vs Cash Purchase - Capital Allocation
# Auto loan cost comparison
# When debt can be obtained at low interest rates, using cheap debt
# and investing the cash that would have been used otherwise) can be
# more tactical, than just deploying cash where cheap debt can suffice.
import math
auto_rate_table = [
0.0219, 0.0429, # Old vs New Rates, Credit Union 1
0.0289, 0.0319, # Old vs New Rates, Credit Uni$on 2
0.0449, 0.0524 # Old vs New Rates, National Bank
@alastairparagas
alastairparagas / Readme.md
Last active May 8, 2022 20:03
Resources for Personal Finance

Alastair's Personal Finance Resources

Personal Plugs and Writings

General resources

  • Bogleheads: https://www.bogleheads.org - full of adherents of John Bogle, founder of Vanguard (now one of the largest mutual fund companies in America, with $7.2 trillion assets under management).
    • The main tenets of Bogleheads are:
  • Focus on costs (expense ratios) when investing on mutual funds. Index investing.
@alastairparagas
alastairparagas / links.txt
Created September 28, 2021 07:02
Math Resource Links
[ 4191.895970] Anomaly Detection (Kernel Hook) - Alastair Paragas
[ 4191.904591] Syscall table address: 00000000c0647077
[ 4191.904595] sizeof(unsigned long long *): 8
[ 4191.904595] sizeof(sys_call_table) : 8
[ 4203.278393] Execve: /usr/bin/sudo, ./target
[ 4203.289339] Execve: ./target, rJgVdaRJqFc7fiCE7Q6M
[ 4216.942554] Execve: /usr/bin/sudo, ./target
[ 4216.952836] Execve: ./target, DR8wEkyRevYXlZMWvmvg
[ 4225.844816] Execve: /usr/bin/sudo, ./target
[ 4225.853263] Execve: ./target, ZeFeXLPHJNzfEwFBrhiW
@alastairparagas
alastairparagas / hooks500.log
Last active June 21, 2020 19:43
Set to 0.05% volatility
[ 3671.330080] Anomaly Detection (Kernel Hook) - Alastair Paragas
[ 3671.334482] Syscall table address: 000000009c24251c
[ 3671.334484] sizeof(unsigned long long *): 8
[ 3671.334484] sizeof(sys_call_table) : 8
[ 3681.637345] Execve: /usr/bin/sudo, ./target
[ 3681.647421] Execve: ./target, rJgVdaRJqFc7fiCE7Q6M
[ 3689.614274] Execve: /usr/bin/sudo, ./target
[ 3689.624160] Execve: ./target, DR8wEkyRevYXlZMWvmvg
[ 3697.999832] Execve: /usr/bin/sudo, ./target
[ 3698.007720] Execve: ./target, ZeFeXLPHJNzfEwFBrhiW
// dynamorio api
#include "dr_api.h"
#include "drmgr.h"
#include "drwrap.h"
#include "drreg.h"
#include "drutil.h"
#include "drx.h"
#include "droption.h"
#include "winbase.h"
import numpy as np
class DTLearner(object):
leaf_size = None
verbose = None
tree = None
def __init__(self, leaf_size=None, verbose=False):
@alastairparagas
alastairparagas / encode.py
Last active April 15, 2020 03:57
Vectorized Encode
import numpy as np
import base64
from typing import List
def encode(ord_key: List[int], some_str: str):
s_len = len(some_str)
ord_key_remapped = np.resize(ord_key, s_len)
encoded_str = np.array(list(map(ord, some_str))) + ord_key_remapped % 256
return base64.urlsafe_b64encode(encoded_str.tostring())
class Solution(object):
def intToRoman(self, num):
"""
:type num: int
:rtype: str
"""
conversion_map = {
1: "I",
5: "V",