Skip to content

Instantly share code, notes, and snippets.

View justinjm's full-sized avatar
🌊

Justin Marciszewski justinjm

🌊
View GitHub Profile
@justinjm
justinjm / microgpt.py
Created February 18, 2026 14:23 — 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
@justinjm
justinjm / Dockerfile
Created March 13, 2023 12:34 — forked from bimission/Dockerfile
RobynDockerfile
FROM gcr.io/deeplearning-platform-release/r-cpu
# install dependencies
RUN apt-get update && \
apt-get install -y \
autoconf \
automake \
g++ \
gcc \
cmake \
# Takes an ordered vector of numeric values and returns a small bar chart made
# out of Unicode block elements. Works well inside dplyr mutate() or summarise()
# calls on grouped data frames.
sparkbar <- function(values) {
span <- max(values) - min(values)
if(span > 0 & !is.na(span)) {
steps <- round(values / (span / 7))
blocks <- c('', '', '', '', '', '', '', '')
paste(sapply(steps - (min(steps) - 1), function(i) blocks[i]), collapse = '')
@justinjm
justinjm / global.R
Created June 8, 2018 17:20 — forked from raymondben/global.R
gauth shiny example
library(googleAuthR)
library(shiny)
library(shinyjs)

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

@justinjm
justinjm / bigquery_schema.py
Created August 3, 2016 20:10 — forked from igama/bigquery_schema.py
Sense / infer / generate a big query schema string for import #bigquery
import mimetypes
import sys
from collections import OrderedDict
filename = sys.argv[1]
def file_type(filename):
type = mimetypes.guess_type(filename)
return type