Skip to content

Instantly share code, notes, and snippets.

View GilesBathgate's full-sized avatar
😄

Giles Bathgate GilesBathgate

😄
View GitHub Profile
@GilesBathgate
GilesBathgate / preprocess.py
Last active December 22, 2023 18:41
Preprocess tinystories for Llama.c
import glob
import json
import os
import multiprocessing
from functools import partial
import random
import re
DATA_CACHE_DIR = "data"
BOYS_NAMES = ["Aaron","Abel","Abigail","Acorn","Adam","Aidan","Aiden","Al","Alan","Albert","Alby","Alex","Alexander","Alfie","Alfred","Ali","Allen","Amos","Andre","Andrew","Andy","Anthony","Antonio","Archie","Arthur","Avi","Bae","Bailey","Barry","Bart","Baxter","Ben","Benjamin","Benji","Bennie","Benny","Bert","Bill","Billy","Blake","Blaze","Bo","Bob","Bobbie","Bobby","Bobo","Boris","Boy","Brad","Braden","Brady","Brayden","Brent","Brett","Brian","Brix","Brody","Bruce","Bruno","Bryan","Bryce","Bubba","Bud","Budd","Bumpkin","Burt","Buster","Buzzy","Cai","Caleb","Calvin","Cape","Captain","Carl","Carlos","Carter","Cat","Chad","Charles","Charlie","Chen","Chet","Chip","Chris","Christopher","Chuck","Clifford","Clive","Clyde","Cody","Cole","Colin","Connor","Conor","Cooper","Corey","Craig","Dale","Damien","Dan","Daniel","Danny","Dare","Darren","Darryl","Dave","Davey","David","Davy","De
""
" "
","
"/"
":"
";"
"c"
"C"
"Q"
"W"
@GilesBathgate
GilesBathgate / no-hashmap.cpp
Created January 28, 2023 16:33
No hashmap concept for CGAL
#include <CGAL/Handle_for.h>
#include <CGAL/Timer.h>
#include <CGAL/Unique_hash_map.h>
#include <boost/any.hpp>
#include <iostream>
#include <list>
#include <stack>
namespace CGAL {
@GilesBathgate
GilesBathgate / Stylegan2-ADA-Pytorch Ubuntu 22.04.01 LTS.md
Last active November 20, 2022 17:42
Stylegan2-ADA-Pytorch Ubuntu 22.04.01 LTS
@GilesBathgate
GilesBathgate / Intersections_benchmark.cpp
Last active March 22, 2022 20:56
Benchmark for SNC_intersection
#define CGAL_NO_ASSERTIONS 1
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Kernel/global_functions.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Timer.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <random>
#include <algorithm>
using K = CGAL::Exact_predicates_exact_constructions_kernel;
@GilesBathgate
GilesBathgate / main.cpp
Created March 9, 2022 10:16
Sphere circle benchmark
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Kernel/global_functions.h>
#include <CGAL/Nef_S2/Sphere_circle.h>
#include <CGAL/point_generators_3.h>
#include <benchmark/benchmark.h>
using K = CGAL::Exact_predicates_exact_constructions_kernel;
using Point = CGAL::Point_3<K>;
using Plane = CGAL::Plane_3<K>;
using Sphere_circle = CGAL::Sphere_circle<K>;
// Copyright (c) 1997-2000
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
@GilesBathgate
GilesBathgate / ID_support_handler_benchmark.cpp
Created November 9, 2020 17:47
ID_support_handler performance benchmark
#include <benchmark/benchmark.h>
#include <CGAL/Nef_3/ID_support_handler.h>
#include <CGAL/Nef_3/SNC_indexed_items.h>
// A bit unconventional ;)
static int data[][2]
#include "sample.data"
;
namespace CGAL {
@GilesBathgate
GilesBathgate / main.cpp
Last active November 4, 2020 17:33
ID_support_handler benchmark.
#include <iostream>
static int allocations = 0;
static int totalBytes = 0;
//Logging allocator
template<class T>
struct Allogator {
typedef T value_type;
T* allocate(size_t n, const void* = nullptr)
G92 E0 ; zero extruder
G1 E-3.0 F1500 ; retract
G4 ; wait
M104 S0 ; turn off temperature
{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up
M106 S255 ; turn fan on
G1 X125 Y0 F3000.0 ; goto middle
M190 R0 T40 ; turn off bed and wait for cooldown
M107 ; turn off fan
G1 X0 Y200 F3000 ; home X axis