Skip to content

Instantly share code, notes, and snippets.

View revolunet's full-sized avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@younesbelkada
younesbelkada / finetune_llama_v2.py
Last active May 6, 2024 23:58
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@kylemcdonald
kylemcdonald / function-calling.ipynb
Created June 14, 2023 01:10
Example of OpenAI function calling API to extract data from LAPD newsroom articles.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josephrocca
josephrocca / resize-and-center-crop.js
Last active April 17, 2023 16:10
Center crop and bicubic/bilinear/lanczos resize image in JavaScript (using wasm-vips)
// Put this in your HTML to load the `Vips` global: <script src="https://cdn.jsdelivr.net/npm/wasm-vips@0.0.2/lib/vips.js"></script>
const vips = await Vips();
async function resizeAndCenterCrop(blob, resizeType="cubic", size=224) {
// resize types available: cubic, linear, lanczos2, lanczos3, nearest, mitchell
let im1 = vips.Image.newFromBuffer(await blob.arrayBuffer());
// Resize so smallest side is `size` px:
const scale = 224 / Math.min(im1.height, im1.width);
@joelonsql
joelonsql / PostgreSQL-EXTENSIONs.md
Last active May 8, 2024 09:24
1000+ PostgreSQL EXTENSIONs

🗺🐘 1000+ PostgreSQL EXTENSIONs

This is a list of URLs to PostgreSQL EXTENSION repos, listed in alphabetical order of parent repo, with active forks listed under each parent.

⭐️ >= 10 stars
⭐️⭐️ >= 100 stars
⭐️⭐️⭐️ >= 1000 stars
Numbers of stars might not be up-to-date.

@sebasjm
sebasjm / package.json
Last active August 16, 2023 05:34
preact cli into single html file
{
"name": "preact single html",
"version": "1.0.0",
"description": "",
"scripts": {
"build-single": "preact build --no-sw --no-esm -c preact.single-config.js --dest single && sh remove-link-stylesheet.sh",
},
"keywords": [],
"author": "",
"license": "ISC"
@degitgitagitya
degitgitagitya / .env
Last active May 4, 2024 11:08
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@pom421
pom421 / form-next-ts-rhf-zod-demo.tsx
Last active December 22, 2023 16:28
Form with React Hook form and zod rules (Next.js page example)
// try it : https://codesandbox.io/s/sample-next-ts-rhf-zod-9ieev
import React from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import type { FieldError } from "react-hook-form";
// JSON.stringify(error) will not work, because of circulare structure. So we need this helper.
@TheDiscordian
TheDiscordian / ipfs_peeradvertiser.py
Last active September 29, 2022 17:18
Advertises the relay address of connected js-ipfs peers to a pubsub channel (announce-circuit)
import requests, json, time, threading, base64, math
# NOTE: This only works with go-ipfs v0.10.0 or *earlier* /w pubsub enabled.
# Use full path to circuit, destination will be appended (you must change these, they are node specific)
CIRCUITS = ["/dns6/ipfs.thedisco.zone/tcp/4430/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/p2p/", "/dns4/ipfs.thedisco.zone/tcp/4430/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/p2p/"]
# The address of your local node (must be accepting websockets and be reverse proxied with SSL support for wss)
NODE = "http://localhost:5001"
# Used for trying to track already announced peers
@rawc0der
rawc0der / crd2jsonschema.sh
Last active April 18, 2024 14:43
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)
@zackad
zackad / nextjs.conf
Created July 1, 2020 10:39
NGINX server configuration for nextjs static generated site.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ /.+ {
try_files $uri $uri.html $uri =404;
}