Skip to content

Instantly share code, notes, and snippets.

View fivejjs's full-sized avatar
🏠
Working from home

vfive fivejjs

🏠
Working from home
  • Data scientist and engineer
  • Sydney Australia
View GitHub Profile
@fivejjs
fivejjs / microgpt.py
Created February 19, 2026 23:19 — forked from karpathy/microgpt.py
microgpt
"""
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fivejjs
fivejjs / Different_style_guide_python.md
Created March 20, 2024 22:39 — forked from nipunsadvilkar/Different_style_guide_python.md
What is the standard Python docstring format?

Formats

Python docstrings can be written following several formats as the other posts showed. However the default Sphinx docstring format was not mentioned and is based on reStructuredText (reST). You can get some information about the main formats in that tuto.

Note that the reST is recommended by the PEP 287

There follows the main used formats for docstrings.

- Epytext

@fivejjs
fivejjs / bbox_iou_evaluation.py
Created October 5, 2023 09:37 — forked from AruniRC/bbox_iou_evaluation.py
Object detector util: match a set of detected bounding boxes and a set of ground-truth bounding boxes
from __future__ import division
import scipy.optimize
import numpy as np
def bbox_iou(boxA, boxB):
# https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/
# ^^ corrected.
# Determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@fivejjs
fivejjs / ParseRSAKeys.java
Created October 4, 2022 23:15 — forked from destan/ParseRSAKeys.java
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@fivejjs
fivejjs / upsert.clj
Created June 9, 2022 23:42 — forked from apeckham/upsert.clj
clojure jdbc copy into temporary table with upsert
(def t (java.io.File/createTempFile "filename" ".txt"))
(println (.getPath t))
(defn row [n]
[(+ n 500000) (rand-int 10000) (rand-int 10000) (rand-int 10000) (rand-int 10000) 5550555 (rand) "hello world"])
(with-open [w (io/writer t)]
(csv/write-csv w (map row (range 1000000))))
(j/with-db-transaction [tx db-spec]
(defn decode-key
"Converts a train case string into a snake case keyword."
[s]
(keyword (str/replace s "_" "-")))
(defn encode-key
"Converts a snake case keyword into a train case string."
[k]
(str/replace (name k) "-" "_"))
@fivejjs
fivejjs / user.clj
Created March 24, 2022 12:16 — forked from spacegangster/user.clj
Getting call graph (vars structure) in Clojure
(ns user)
; Hey, I've been playing a bit with graphing out the structure of a module for Lightpad.
; It worked well, I've found the target function that I'll need change to add a new feature.
; Tweet with a screenshot https://twitter.com/spacegangster/status/1324760381735272450
; lein coordinate
; [com.gfredericks/clj-usage-graph "0.3.0"]
; https://github.com/gfredericks/clj-usage-graph