Skip to content

Instantly share code, notes, and snippets.

View RobertoMalatesta's full-sized avatar

Roberto Malatesta RobertoMalatesta

View GitHub Profile
@RobertoMalatesta
RobertoMalatesta / grpo_demo.py
Created February 5, 2025 00:11 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@RobertoMalatesta
RobertoMalatesta / optimg.sh
Created November 29, 2024 01:31 — forked from spaze/optimg.sh
Optimize images in the current dir with Zopfli (for PNGs), Guetzli (for JPEGs), WebP (for both lossy and lossless conversions). Keeps the smaller file of those.
#!/bin/bash
# Optimize images for talk slides
# Run in directory with images, it does the following:
# 1. runs zopfli on all PNGs
# 2. runs guetzli on all JPEGs
# 3. creates lossy and lossless WebP, keeps the smaller one
# 4. keeps the WebP if smaller than original
GREEN=$(tput setaf 2)
@RobertoMalatesta
RobertoMalatesta / HolographicMaterial.js
Created September 16, 2024 21:36 — forked from ektogamat/HolographicMaterial.js
HolographicMaterial for React Three Fiber
/**
* Holographic material component by Anderson Mancini - Dec 2023.
* Dec 7th - Added useMemo for better performance
*/
import React, { useRef, useMemo } from 'react'
import { shaderMaterial } from '@react-three/drei'
import { extend, useFrame } from '@react-three/fiber'
import {
Color,
@RobertoMalatesta
RobertoMalatesta / AttributeFactoryHelpers.java
Created September 6, 2024 03:09 — forked from TronPaul/AttributeFactoryHelpers.java
Substitutions needed to run Lucene 8.4.1 on a GraalVM native image
package org.apache.lucene.util;
import java.lang.reflect.Constructor;
import java.lang.reflect.UndeclaredThrowableException;
public final class AttributeFactoryHelpers {
static final AttributeFactory DEFAULT = new DefaultAttributeFactory();
static final Constructor<? extends AttributeImpl> findAttributeImplCtor(Class<? extends AttributeImpl> clazz) {
try {
@RobertoMalatesta
RobertoMalatesta / gist:d6a968d252170c04b04afc42ea96dffb
Created August 11, 2024 11:32 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array

Awesome-Selfhosted

Awesome

Selfhosting is the process of locally hosting and managing applications instead of renting from SaaS providers.

This is a list of Free Software network services and web applications which can be hosted locally. Non-Free software is listed on the Non-Free page.

See Contributing.

@RobertoMalatesta
RobertoMalatesta / OpenUI5: UI5 Table Example
Created August 5, 2023 02:27 — forked from timlizzy/OpenUI5: UI5 Table Example
OpenUI5: UI5 Table Example with data binding, using a local JSON Model
<!DOCTYPE html>
<html><head>
<meta name="description" content="UI5 table example with local JSON model" />
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>UI5 Table Example</title>
<!-- Load UI5, select gold reflection theme and the "commons" and "table" control libraries -->
<script id='sap-ui-bootstrap' type='text/javascript'
@RobertoMalatesta
RobertoMalatesta / gist:978a2ff004483a47eaefb5f72a755224
Created March 4, 2023 15:17 — forked from stonegao/gist:3926395
Fast ways of writing to disk in Java
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
/**
* Compares the performance of streaming data to disk vs using memory mapped files.
*.
public class MappedIO {
private static int numOfInts = 4000000;
@RobertoMalatesta
RobertoMalatesta / WebGL-WebGPU-frameworks-libraries.md
Created September 29, 2020 01:37 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • stack.gl: an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • Filament: Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS and WASM/WebGL
  • ClayGL: A WebGL graphic library
@RobertoMalatesta
RobertoMalatesta / Large List
Created August 30, 2020 22:59 — forked from defly/Large List
Recuiter Spam List
@199rec.co.uk
@24-7recruitment.net
@2kpeople.co.uk
@33six.net
@365rec.com
@3aaa.co.uk
@3rglobal.com
@48digital.co.uk
@4itrecruitment.co.uk
@752solutions.com