Skip to content

Instantly share code, notes, and snippets.

View nebrelbug's full-sized avatar

Ben Gubler nebrelbug

View GitHub Profile
@nebrelbug
nebrelbug / accelerate_config.yaml
Last active November 8, 2023 01:50
Rebuilding Alpaca with the Hugging Face Trainer Class (see https://bengubler.com/posts/rebuilding-alpaca-huggingface-trainer)
View accelerate_config.yaml
compute_environment: LOCAL_MACHINE
deepspeed_config: {}
distributed_type: 'NO'
downcast_bf16: 'no'
machine_rank: 0
main_process_ip: null
main_process_port: null
main_training_function: main
mixed_precision: 'no'
num_machines: 1
@nebrelbug
nebrelbug / get_data.py
Created November 7, 2023 23:24
Rebuilding Alpaca with the Hugging Face Trainer Class
View get_data.py
from datasets import load_dataset
IGNORE_TOKEN = -100
#####################
# FORMAT DATA #
#####################
template_context = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
@nebrelbug
nebrelbug / .bashrc
Last active November 28, 2019 04:46
NiftyBash: customize terminal prompt to show package.json version, git branch, and commit status (this is the end of my `.bashrc`)
View .bashrc
COLOR_RED="\033[0;31m"
COLOR_YELLOW="\033[0;33m"
COLOR_GREEN="\033[0;32m"
COLOR_OCHRE="\033[38;5;95m"
COLOR_BLUE="\033[0;34m"
COLOR_WHITE="\033[0;37m"
COLOR_RESET="\033[0m"
function git_color() {
local git_status="$(git status 2>/dev/null)"
@nebrelbug
nebrelbug / Parse.js
Last active July 15, 2019 20:37
A parser for SquirrellyJS
View Parse.js
// Version 1.0.21
var parseTag = require('./TagParse')
module.exports = function Parse (str, tagOpen, tagClose) {
var lastIndex = 0 // Because lastIndex can be complicated, and this way the minifier can minify more
var regEx = new RegExp(tagOpen + '(-)?([^]*?)(-)?' + tagClose, 'g')
var stringLength = str.length
function parseContext (parentObj, firstParse) {
var lastBlock = false
@nebrelbug
nebrelbug / index.js
Created November 14, 2018 04:23
Defining a Squirrelly helper that will translate written colors to hex codes
View index.js
Sqrl.defineHelper("returnColor", function (arg) { // In our case, the argument will be the value of 'options.color'
var colorScheme = { // This just maps the written colors to hex codes. Try editing or adding more colors!
brightgreen: "#4c1",
green: "#97CA00",
orange: "#fe7d37",
red: "#e05d44",
blue: "#007ec6",
}
if (colorScheme.hasOwnProperty(arg)) { // Then the color has a valid hex code associated with it
var result = colorScheme[arg] // Get the hex code
@nebrelbug
nebrelbug / template
Created November 14, 2018 03:55
An SVG template for Squirrelly which will render ReadMe badges
View template
{{js(options.leftWidth = options.left.length * 10)/}}
{{js(options.rightWidth = options.right.length * 13 + 5)/}}
{{js(options.totalWidth = options.leftWidth + options.rightWidth - 5)/}}
<svg xmlns="http://www.w3.org/2000/svg" width="{{ totalWidth }}" height="20">
<linearGradient id="smooth" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
@nebrelbug
nebrelbug / index.js
Created November 14, 2018 00:06
Basic server with Squirrelly and Express
View index.js
let express = require('express');
let path = require('path');
let app = express();
var Sqrl = require('squirrelly')
let server = app.listen(8080, function () {
console.log("listening to requests on port 8080");
});
app.get('/:left/:right/:color', function (req, res) {
@nebrelbug
nebrelbug / index.js
Last active November 14, 2018 00:03
Write a program that dynamically serves badges with Express and Squirrelly
View index.js
let express = require('express');
let path = require('path');
let app = express();
var Sqrl = require('squirrelly')
let server = app.listen(8080, function () {
console.log("listening to requests on port 8080");
});
Sqrl.defineHelper("returnColor", function (args, content, blocks) {
@nebrelbug
nebrelbug / boot.asm
Created June 13, 2018 05:07
The bootcode of my toy kernel following Phil-Opp's OS tutorials
View boot.asm
;Based on the tutorials by Phil Opperman
global start
extern long_mode_start
section .text
bits 32
start:
mov esp, stack_top ;ESP is the stack pointer register, so (I think?) telling computer where stack is
mov edi, ebx ; Move Multiboot info pointer to edi