Skip to content

Instantly share code, notes, and snippets.

@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 22, 2024 08:47
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@clemensgg
clemensgg / gist:81307bded1b99d166c484049d0f5246c
Last active February 26, 2022 21:54
configure hermes relayer to use feegrant module for omniflix
# omniflix team are granting relayer accounts to pay fees from a specified 'granter' account
# fill out the relayer-coordination-sheet provided by the team to get your relayer account whitelisted (granted)
# works with hermes v0.11.0 and higher (https://github.com/informalsystems/ibc-rs)
# config.toml (set granter account, set your endpoints, comment out channels you don't relay)
[[chains]]
id = 'omniflixhub-1'
rpc_addr = 'http://...'
grpc_addr = 'http://...'
@rigelrozanski
rigelrozanski / imgcat.go
Created April 30, 2020 03:55
Iterm2 imgcat image output from golang
import (
"encoding/base64"
"fmt"
"io/ioutil"
"os"
)
func main() {
r, err := os.Open("yourimagehere.png")
if err != nil {
@aaronc
aaronc / key-management.md
Last active October 31, 2022 23:09
Key groups, msg and fee delegation from the Gaians team at Hackatom Berlin 2019

Fee delegation

The delegation module also allows for fee delegation via some changes to the AnteHandler and StdTx. The behavior is similar to that described above for Msg delegations except using the interface FeeAllowance instead of Capability:

// FeeAllowance defines a permission for one account to use another account's balance
// to pay fees
@anacampesan
anacampesan / gifFrameDisposal.js
Last active April 24, 2023 12:02
GIF Frame Disposal Correction Algorithm
function explodeGif(gifUrl) {
return gifler(gifUrl)._animatorPromise.then(function(gif) {
let current = createTempCanvas(gif.width, gif.height, 'current');
let currentCtx = current.getContext('2d');
let temp = createTempCanvas(gif.width, gif.height, 'temp');
let tempCtx = temp.getContext('2d');
gif._animationLength = 0;
for (let i = 0; i < gif._frames.length; i++) {
@spyesx
spyesx / rsync_backup.sh
Last active February 16, 2024 14:03
Rsync backup excluding node_modules
# Backup files
#https://explainshell.com/explain?cmd=rsync+-azuv+--delete+--progress+--exclude+%27node_modules%27
rsync -auvhp --delete --exclude=node_modules [source] [destination]
# Remove all node_modules folders
# https://explainshell.com/explain?cmd=find+.+-name+%22node_modules%22+-type+d+-prune+-exec+rm+-rf+%27%7B%7D%27+%2B
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
@GNSPS
GNSPS / ProxyFactory.sol
Last active October 9, 2021 08:47
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.5]
/***
* Shoutouts:
*
* Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
* Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here: https://gist.github.com/izqui/7f904443e6d19c1ab52ec7f5ad46b3a8
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe: https://github.com/gnosis/gnosis-safe-contracts
*
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory: https://github.com/gnosis/gnosis-safe-contracts/blob/master/contracts/ProxyFactory.sol
@codediodeio
codediodeio / database.rules.json
Last active January 28, 2024 19:07
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@naterush
naterush / AcceptMyTx.sol
Created June 4, 2017 18:54
This contract allows users to keep their gas price very low while still effectively paying miners. This would allow users to circumnavigate any imposed gas price maximums.
pragma solidity ^0.4.10;
contract AcceptMyTx {
function forwardTransaction(address destination, bytes data, uint amountToMiner) payable {
block.coinbase.transfer(amountToMiner);
destination.call.value(msg.value - amountToMiner)(data); //even in case of failure, miner is paid
}
}
@jimmywarting
jimmywarting / readme.md
Last active April 30, 2024 21:38
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers