Skip to content

Instantly share code, notes, and snippets.

Always learning

Anton Bacaj abacaj

Always learning
View GitHub Profile
abacaj /
Created April 30, 2023 21:16 — forked from NaxAlpha/
Training script for LongGPT; Fine-tunes GPT-2 (335M) on The Pile Dataset with a context size of 8k tokens. (requires > 16GB RAM)
import time
from contextlib import suppress
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cuda as cuda
from import DataLoader, IterableDataset
View index.html
<!DOCTYPE html>
<html class="no-js" lang="">
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="" />
<meta property="og:type" content="" />
abacaj / main.dart
Last active September 15, 2018 18:24
View main.dart
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:flutter/material.dart';
void main() {
title: 'Navigation Basics',
home: FirstScreen(items: List<String>.generate(40, (i) => "Item $i")),
abacaj /
Created January 30, 2017 15:58 — forked from austinhyde/
Vanilla JavaScript Data Binding


You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5


View move_files.cs
class Program
static void Main(string[] args)
Console.WriteLine("Enter base directory:");
var basePath = Console.ReadLine();
Console.WriteLine("Enter destination directory (this will be created for you, make sure it doesn't exist):");
var destination = Console.ReadLine();
var directories = System.IO.Directory.EnumerateDirectories(basePath);
View fizzbuzz.js
// Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
function fizzbuzz() {
for (var i = 1; i <= 100; i++) {
var str = "";
str += (i % 3 === 0) ? "fizz" : "";
str += (i % 5 === 0) ? "buzz" : "";
str = (str) ? str : i;
abacaj / HttpHandler.scala
Last active October 5, 2016 16:50
Using a Map to hold routes with Akka
View HttpHandler.scala
import scala.collection.mutable.Map
import scala.concurrent.ExecutionContextExecutor
import akka.http.scaladsl.model.ContentTypes
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.model.HttpEntity.ChunkStreamPart
import akka.http.scaladsl.model.HttpEntity.apply
import akka.http.scaladsl.model.HttpProtocols
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCode
abacaj / fibonacci.js
Created November 16, 2015 15:58
A simple implementation of fibonacci in javascript.
View fibonacci.js
function fibonacci(size) {
var first = 0,
second = 1,
count = 2,
result = [first, second];
if(size < 2) {
abacaj / dom-util.js
Last active November 16, 2015 16:03
High performance utility for manipulating DOM classes.
View dom-util.js
var testDiv = document.querySelector('.test-div');
function filterSpaces(strArray) {
return strArray.filter(function(str) {
return /\S/.test(str);
function addClass(elem, className) {
var classes = filterSpaces(elem.className.split(' '));
abacaj / SassMeister-input-HTML.html
Created June 4, 2015 21:21
Generated by
View SassMeister-input-HTML.html
<span class="primary">#</span>
<span class="primary-l-1">#</span>
<span class="primary-l-2">#</span>
<span class="primary-l-3">#</span>
<span class="primary-l-4">#</span>
<span class="secondary">#</span>