Skip to content

Instantly share code, notes, and snippets.

View gustaveiffel's full-sized avatar
💭
dreaming

gustaveiffel

💭
dreaming
View GitHub Profile
@willccbb
willccbb / grpo_demo.py
Last active April 21, 2025 12:44
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
@ArthurZucker
ArthurZucker / static_kv_cache.py
Last active October 21, 2024 02:08
simple static kv cache script
from transformers import AutoModelForCausalLM, AutoTokenizer, StaticCache
import torch
from typing import Optional
device = "cuda"
# Copied from the gpt-fast repo
def multinomial_sample_one_no_sync(probs_sort): # Does multinomial sampling without a cuda synchronization
q = torch.empty_like(probs_sort).exponential_(1)
return torch.argmax(probs_sort / q, dim=-1, keepdim=True).to(dtype=torch.int)
@arturo182
arturo182 / bom2grouped_csv_jlcpcb.xsl
Last active January 29, 2025 17:01
A KiCad BOM script for generating JLCPCB PCBA-compatible files!
<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format
Copyright (C) 2014, Wolf Walter.
Copyright (C) 2013, Stefan Helmert.
Copyright (C) 2018, Kicad developers.
Copyright (C) 2019, arturo182.
GPL v2.
Functionality:
Generation of JLCPCB PCBA compatible BOM
@hhromic
hhromic / wpe-yocto.md
Last active January 28, 2023 13:53
Building WPE with Yocto for Raspberry Pi Zero W

Repositories Cloning

BRANCH=master  # or 'rocko'
xargs -n 1 git clone -b $BRANCH <<'__EOF__'
git://git.yoctoproject.org/poky
git://git.openembedded.org/meta-openembedded
git://github.com/agherzan/meta-raspberrypi
git://github.com/webplatformforembedded/meta-wpe
__EOF__
@thomasdarimont
thomasdarimont / app.py
Last active January 22, 2025 22:38
Simple python example using flask, flask_oidc and keycloak
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@sagivo
sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active April 5, 2025 21:54
webRTC stun / turn server list
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@oillio
oillio / MyServiceImpl.java
Created October 5, 2016 20:05
bi-directional stream gRPC with RxJava
public class MyServiceImpl extends DeviceServiceGrpc.DeviceServiceImplBase {
@Override
public StreamObserver<GetLocationRequest> getLocations(StreamObserver<GetLocationResponse> responseObserver) {
RequestBridge<GetLocationRequest> request = new RequestBridge<>();
ResponseBridge response = new ResponseBridge((ServerCallStreamObserver) responseObserver);
request.map(this::doGetLocation)
.subscribe(response);
return request;
}
@jasonrdsouza
jasonrdsouza / combineS3Files.py
Last active June 3, 2023 17:22
Python script to efficiently concatenate S3 files
'''
This script performs efficient concatenation of files stored in S3. Given a
folder, output location, and optional suffix, all files with the given suffix
will be concatenated into one file stored in the output location.
Concatenation is performed within S3 when possible, falling back to local
operations when necessary.
Run `python combineS3Files.py -h` for more info.
'''
@SpringBootApplication
@EnableBinding(Source.class)
class TrackerNetKafkaSource {
static {
Environment.initializeIfEmpty().assignErrorJournal()
}
static def TFL_URL = "http://cloud.tfl.gov.uk/TrackerNet/PredictionSummary/C"
@samklr
samklr / hdfs-mesos.md
Last active December 5, 2019 19:20
Setup HDFS on Mesos, Run Spark Cluster dispatcher via Marathon

Setup Mesos-DNS

Scripts for setting up

sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json