Skip to content

Instantly share code, notes, and snippets.

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@AnthonyFJGarner
AnthonyFJGarner / trend_following_1.ipynb
Created December 12, 2018 11:11
A Simple Trend Following System in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AnthonyFJGarner
AnthonyFJGarner / mean_reversion.ipynb
Last active October 14, 2025 05:01
A Simple Mean Reversion System in Simple Python Code
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imtaehyun
imtaehyun / technical-analysis-indicators-without-talib-code.py
Last active May 9, 2025 16:31
Technical analysis Indicators without Talib (code)
# https://www.quantopian.com/posts/technical-analysis-indicators-without-talib-code
import numpy
import pandas as pd
import math as m
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
@gpocentek
gpocentek / gl-form.py
Created December 12, 2017 11:44
python-gitlab login/password auth using cookies
import re
import sys
import requests
import gitlab
URL = 'https://gitlab.com'
SIGN_IN_URL = 'https://gitlab.com/users/sign_in'
@abhi1010
abhi1010 / cpp_time_ostream.log
Last active April 23, 2019 06:12
print std::chrono::duration
edit mode | history
10 hours
36000 seconds
60000 intervals of 0.600000 (3/5) seconds each
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@abhi1010
abhi1010 / generate_diagram.py
Created September 24, 2015 04:19 — forked from jul/generate_diagram.py
building entitty relation ship diagram from a db by using introspection
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlsoup import SQLSoup as sql
from sys import argv
DIGRAPH = """digraph structs {
graph [
rankdir= "LR"
bgcolor=white
]