Skip to content

Instantly share code, notes, and snippets.

View j2kun's full-sized avatar
💭
Math math math math math math math

Jeremy Kun j2kun

💭
Math math math math math math math
View GitHub Profile

Keybase proof

I hereby claim:

  • I am j2kun on github.
  • I am j2kun (https://keybase.io/j2kun) on keybase.
  • I have a public key whose fingerprint is AD0B 0C0F 8714 4E1B 9888 55EB ED3B ECB2 0A50 EABB

To claim this, I am signing this object:

@j2kun
j2kun / rename_all_default_branches.md
Last active June 9, 2020 03:36
Changing default branch on all your git repos

Rename all default branches of a github user

Basically, it does this for all the repos you own

Requirements

brew install hub
brew install jq
Month Price Percent change
10/1/2020 3374.70 0.27
9/1/2020 3365.52 -0.77
8/1/2020 3391.71 5.41
7/1/2020 3217.73 2.80
6/1/2020 3130.20 5.76
5/1/2020 2959.74 5.71
4/1/2020 2799.99 4.83
3/1/2020 2670.92 -18.89
2/1/2020 3293.02 -0.30
@j2kun
j2kun / predict.py
Created May 2, 2021 23:21
Predicting a number sequence from an unknown polynomial by finite differences
from rich import print
from rich.table import Table
def subsequent_pairs(L):
L = iter(L)
a = next(L)
b = next(L)
while True:
yield (a, b)
@j2kun
j2kun / state_machine.py
Created July 2, 2021 04:07
Copilot-generated state machine
class StateMachine: # pragma: no cover
"""
A simple state machine implementation.
"""
def __init__(self):
self.handlers = {}
self.startState = None
self.endStates = []
def add_state(self, name, handler, end_state=0):
Copilot-completed given the prompt:
class AsyncQueue {
constructor() {
// Values that have been queued but not dequeued yet are stored here
this.values = [];
// When Promises are dequeued before their corresponding values are
// queued, the resolve methods for those Promises are stored here.
this.resolvers = [];
// Once closed, no more values can be enqueued, and no more unfulfilled
@j2kun
j2kun / .chktexrc
Created November 16, 2021 19:47
An example chktex-action configuration
# in the base directory of your project
QuoteStyle = Traditional
VerbEnvir
{
verbatim comment listing verbatimtab rawhtml errexam picture texdraw
filecontents pgfpicture tikzpicture minted lstlisting texttt
solution
}
# $ python3 --version
# Python 3.10.1
# $ python3 hilbert.py
# [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (2, 3), (3, 3), (3, 4), (4, 4), (4, 5), (5, 5), (5, 6), (5, 7), (6, 7), (6, 8), (7, 8)]
import math
def hilbert_iter(n):
(i, j) = (0, 0)
from dataclasses import dataclass
import numpy as np
import pymc3 as pm
@dataclass
class SkillDistribution:
'''A class representing the data of a skill distribution.
'''An implementation of a media mix model.'''
import pymc3 as pm
import numpy as np
# currently no adstock transformation...
def tanh_saturation(x, users_at_saturation, initial_cost_per_user):
'''A saturation function based on the hyperbolic tangent.