Skip to content

Instantly share code, notes, and snippets.

@paolobrasolin
paolobrasolin / README.md
Last active April 9, 2024 07:30
A::B prompting challenge
@buttercutter
buttercutter / fff.py
Last active November 26, 2023 07:14
A work-in-progress code for [Fast Feedforward Networks](http://arxiv.org/abs/2308.14711)
import torch
from torch import nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
from tqdm import tqdm
# Custom fast linear layer
class FastLinear(nn.Module):
def __init__(self, in_features, out_features):
#!/bin/bash
# Default values
MODEL="llama-2-13b-chat.ggmlv3.q4_0.bin"
THREADS=8
NGL=1
COLOR="--color"
C_FLAG=2048
TEMP=0.7
REPEAT_PENALTY=1.1
@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
@Dan-Q
Dan-Q / _no_code_page_.php
Last active May 3, 2024 08:46
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@repi
repi / crate-health.md
Last active February 22, 2024 01:17
Guidelines on evaluating health & quality of third-party crates at Embark

What to evaluate and consider before adding usage of new third-party crates.

These are not exact requirements but questions to investigate and discuss to help reason around the health, safety, maintainability, and more around crates.

This can also be read as an opinionated guide for crate authors of what our (Embark's) guidelines and recommendations are, though should not be taken too literally.

Legend: 🔒 Must have, ⭐️ Should have, 👍 Nice to have, ℹ️ Info

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@brendanzab
brendanzab / gist:d41c3ae485d66c07178749eaeeb9e5f7
Last active July 19, 2023 04:28
My personal list of Rust grievances (September 2021)

September 2022:

This has spread to a far wider audience than I had anticipated - probably my fault for using a title that is in hindsight catnip for link aggregators. I wrote this back in 2021 just as a bunch of personal thoughts of my experiences using Rust over the years (not always well thought through), and don't intend on trying to push them further, outside of personal experiments and projects.

Managing a living language is challenging and difficult work, and I am grateful for all the hard work that the Rust community and contributors put in given the difficult constraints they work within. Many of the things I listed below are not new, and there's been plenty of difficult discussions about many of them over the years, and some are being worked on or postponed, or rejected for various good reasons. For more thoughts, please see my comment below.

My personal list of Rust gr

@o0Ignition0o
o0Ignition0o / Cargo.toml
Created April 9, 2021 08:04
Bastion http probe using reqwest
[package]
name = "bastion_probe_test"
version = "0.1.0"
authors = ["o0Ignition0o <jeremy.lempereur@gmail.com>"]
edition = "2018"
[dependencies]
bastion = { git = "https://github.com/bastion-rs/bastion.git", features = ["tokio-runtime"] }
tokio = { version = "1.4", features = ["time", "macros"] }
url = "2.2"
@surpher
surpher / rust_to_swift.md
Last active April 25, 2024 12:30
Building binaries from Rust to iOS/macOS (PactSwift specific)