Skip to content

Instantly share code, notes, and snippets.

@younesbelkada
younesbelkada / finetune_llama_v2.py
Last active May 14, 2024 05:46
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
# sleepy flower girl
(◡ ‿ ◡ ✿)
# y u no
ლ(ಠ益ಠლ)
# smiling breasts
(^人^)
# flipping tables
@chranderson
chranderson / nvmCommands.js
Last active May 14, 2024 05:44
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
import { Client } from "@upstash/qstash"
import { NextRequest } from "next/server"
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`
: "http://localhost:3000"
interface Step<I> {
create: <O>(action: (prevResult: Awaited<I>) => O) => Step<O>
finally: (action: (prevResult: Awaited<I>) => any) => any
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@druska
druska / engine.c
Created September 17, 2018 15:18
Quant Cup 1's winning order book implementation
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
@riggaroo
riggaroo / GraphicsBlend.kt
Last active May 14, 2024 05:42
GraphicsLayer APIs - BlendMode per layer
@Preview
@Composable
private fun GraphicsLayerBlendModes() {
Box(modifier = Modifier
.fillMaxSize()){
Image(
painter = painterResource(id = R.drawable.sunset),
contentDescription = null
)
val graphicsLayer2 = rememberGraphicsLayer()
@Robyer
Robyer / maven-publish-helper-usage.gradle
Last active May 14, 2024 05:41
Gradle script for publishing Android library with sources and javadoc to Maven repository using maven-publish plugin.
// You can use maven-publish-helper.gradle script without changes and even share it between multiple
// modules. Just place the maven-publish-helper.gradle file in the root directory of your project,
// then apply it at the bottom of your module's build.gradle file like this:
// ...content of module's build.gradle file...
apply from: '../maven-publish-helper.gradle'
publishing {
publications {
@antoinekociuba
antoinekociuba / delete_merged_git_branches_remotely
Last active May 14, 2024 05:38
Delete all merged branches from the remote Git repository (assuming master is the main branch)
# Sources: https://community.atlassian.com/t5/Bitbucket-questions/Is-there-a-way-to-delete-branches-in-bulk/qaq-p/547331
# Make sure remotes are up to date (with stale remotes purged):
git fetch -p
# Initial no-op run --- do the branches to delete look correct?
# Be careful to omit 'master' from the output.
git branch --remote --merged origin/master | grep -v 'master' | cut -b 10- | xargs
# Do the bulk delete!!! (can take a long time...)