Skip to content

Instantly share code, notes, and snippets.

View wotori's full-sized avatar
🦀
Fighting with the borrow checker

Wotori Movako wotori

🦀
Fighting with the borrow checker
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active May 17, 2024 08:27
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
const CwStargate = require("@cosmjs/cosmwasm-stargate");
const RPC = process.env.RPC;
const CONTRACT = process.env.CONTRACT;
async function cwClient() {
const cwClient = await CwStargate.SigningCosmWasmClient.connectWithSigner(RPC, null);
return cwClient;
}
@cedrickchee
cedrickchee / llama-7b-m1.md
Last active May 2, 2024 12:47
4 Steps in Running LLaMA-7B on a M1 MacBook with `llama.cpp`

4 Steps in Running LLaMA-7B on a M1 MacBook

The large language models usability

The problem with large language models is that you can’t run these locally on your laptop. Thanks to Georgi Gerganov and his llama.cpp project, it is now possible to run Meta’s LLaMA on a single computer without a dedicated GPU.

Running LLaMA

There are multiple steps involved in running LLaMA locally on a M1 Mac after downloading the model weights.

@stevedylandev
stevedylandev / unpins.js
Last active December 20, 2023 16:57
This script will unpin all files from your Pinata account! You can alter the PIN_QUERY to adjust it if you only want to delete a range of files
const PINATA_JWT = 'Bearer YOUR_JWT_HERE'
const PIN_QUERY = `https://api.pinata.cloud/data/pinList?status=pinned&pageLimit=1000&includeCount=false`
const fetch = require('node-fetch')
const wait = (milliseconds) => {
return new Promise((resolve) => {
setTimeout(resolve, milliseconds);
});
};
def is_valid(grid, r, c, k):
not_in_row = k not in grid[r]
not_in_column = k not in [grid[i][c] for i in range(9)]
not_in_box = k not in [grid[i][j] for i in range(r//3*3, r//3*3+3) for j in range(c//3*3, c//3*3+3)]
return not_in_row and not_in_column and not_in_box
def solve(grid, r=0, c=0):
if r == 9:
return True
@vrslev
vrslev / main.py
Last active March 11, 2024 09:23
Automatic browser reloading in FastAPI
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
@octalmage
octalmage / keplr.js gist
Last active September 19, 2022 16:49 — forked from clevinson/keplr.js gist
DO NOT RUN THIS
{
"chainId": "phoenix-1",
"chainName": "Terra 2.0",
"rpc": "https://terra-rpc.polkachu.com/",
"rest": "https://phoenix-lcd.terra.dev/",
"stakeCurrency": {
"coinDenom": "LUNA",
"coinMinimalDenom": "uluna",
"coinDecimals": 6,
"coinGeckoId": "terra-luna"

Ubuntu20.04 Wine 6.0 微信中文显示方块/方框

如果希望在Ubuntu使用Windows版微信:

  1. 安装 Wine sudo apt-get install wine
  2. 先把环境改了省事:
    $ export WINEARCH=win32
    $ export WINEPREFIX=/home/qinyu/Wine/WeChat
  3. 创建 Wine Bottle
@mortenbh
mortenbh / Install_Maya_2020_Arnold_Bifrost_on_Ubuntu_Focal_Fossa_(20.04).md
Created December 23, 2020 17:14
Install Maya 2020, Arnold and Bifrost on Ubuntu Focal Fossa (20.04)

Download and install dependencies

sudo apt install wget alien libjpeg62 libcurl4 libaudiofile1 libtinfo5 python mesa-opencl-icd xfonts-100dpi xfonts-75dpi

wget http://ftp.br.debian.org/debian/pool/main/o/openssl1.0/libssl1.0.2_1.0.2u-1~deb9u1_amd64.deb
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/33/Everything/x86_64/os/Packages/l/libpng15-1.5.30-11.fc33.x86_64.rpm

fakeroot alien -vc libpng15-1.5.30-11.fc33.x86_64.rpm
@hendi
hendi / rocket-sqlx.rs
Last active February 4, 2024 05:23
Rust: rocket with sqlx
#[macro_use] extern crate rocket;
use std::env;
use anyhow::Result;
use rocket::State;
use rocket::http::Status;
use sqlx::{Pool, Postgres};