Skip to content

Instantly share code, notes, and snippets.

View iPaulPro's full-sized avatar

Paul Burke iPaulPro

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active May 9, 2024 03:18
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; // ¯\\_(ツ)_/¯
@arcanite24
arcanite24 / gist:fa69b647552fe6f067c888dfc31737a8
Created July 21, 2023 15:11
SDXL Pixel Art ComfyUI Workflow
{
"last_node_id": 47,
"last_link_id": 63,
"nodes": [
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
317,
352
@rain-1
rain-1 / llama-home.md
Last active May 7, 2024 21:04
How to run Llama 13B with a 6GB graphics card

This worked on 14/May/23. The instructions will probably require updating in the future.

llama is a text prediction model similar to GPT-2, and the version of GPT-3 that has not been fine tuned yet. It is also possible to run fine tuned versions (like alpaca or vicuna with this. I think. Those versions are more focused on answering questions)

Note: I have been told that this does not support multiple GPUs. It can only use a single GPU.

It is possible to run LLama 13B with a 6GB graphics card now! (e.g. a RTX 2060). Thanks to the amazing work involved in llama.cpp. The latest change is CUDA/cuBLAS which allows you pick an arbitrary number of the transformer layers to be run on the GPU. This is perfect for low VRAM.

  • Clone llama.cpp from git, I am on commit 08737ef720f0510c7ec2aa84d7f70c691073c35d.
@L-Kov
L-Kov / ctf.ts
Created January 6, 2023 20:01
Conditional Tokens Framework Calculations
import { keccak256 as solidityKeccak256 } from "@ethersproject/solidity";
import BN from "bn.js";
export const getConditionId = (oracle: string, questionId: string, outcomeSlotCount: number): string =>
solidityKeccak256(["address", "bytes32", "uint256"], [oracle, questionId, outcomeSlotCount]);
const altBN128P = new BN("21888242871839275222246405745257275088696311157297823662689037894645226208583");
const altBN128PRed = BN.red(altBN128P);
const altBN128B = new BN(3).toRed(altBN128PRed);
const zeroPRed = new BN(0).toRed(altBN128PRed);
import pdi.jwt.{Jwt, JwtAlgorithm}
import org.bitcoins.core.util.Base58
import org.bouncycastle.jce.spec.ECPublicKeySpec
import org.bouncycastle.jce.ECNamedCurveTable
import org.bouncycastle.jce.provider.BouncyCastleProvider
import java.security.{KeyFactory, PublicKey, Security}
import scala.util._
val jwtToken = "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NDg1OTcwNzIsImV4cCI6MTY0ODU5NzY3Mn0.MFEtqJzrLTnjYwH4gAOsH-0qsrQIFsKcYHyHdE1WdWHLn_xa-fGPoV3OkDLr0Rk1IcIoawSrDXNxkyZR0wGhFw"
val desoPKey = "BC1YLhwpmWkgk2iM9yTSxzgUVhYjgessSPTiVHkkK9pMrhweqJnWrvK"
{
"text_prompts": {
"0": [
"ok computer radiohead artwork"
],
"300": [
"ok computer radiohead artwork | UFO alien artstation art abduction painting"
],
"589": [
"ok computer radiohead artwork | alien ship artstation ufo | I want to believe alien jpg meme"
@iPaulPro
iPaulPro / bitclout-pg.js
Last active April 4, 2024 20:37
Query BitClout Postgres DB with public key
const bs58check = require('bs58check')
const getPublicKeyBase64 = (publicKeyBase58Check) => {
const decoded = bs58check.decode(publicKeyBase58Check);
const payload = Uint8Array.from(decoded).slice(3);
return Buffer.from(payload).toString('base64');
}
const getPublicKeyBase58Check = (bytea) => {
const prefix = [0xcd, 0x14, 0x0];
@jayrambhia
jayrambhia / Android TopSheetDialog Implementation by Taskito.md
Last active December 16, 2023 12:36
Android Top Sheet Implementation
<style name="TopSheet_DialogAnimation">
  <item name="android:windowEnterAnimation">@anim/slide_out_from_top</item>
  <item name="android:windowExitAnimation">@anim/slide_back_to_top</item>
</style>

slide_out_from_top

package com.booking.debug.performance
import android.os.SystemClock
import android.util.Log
/**
* Simple class to check the execution time between several execution points across threads.
* Unlike [TraceCompat](https://developer.android.com/reference/androidx/core/os/TraceCompat)
* it is not expected to 'begin' and 'end' sections but it will just print the time between
* the points being tracked.
@Frank1234
Frank1234 / ViewBindingHolder.kt
Last active December 14, 2020 11:36
Holds and manages ViewBinding inside a Fragment.
/**
* Holds and manages ViewBinding inside a Fragment.
*/
interface ViewBindingHolder<T : ViewBinding> {
val binding: T?
/**
* Saves the binding for cleanup on onDestroy, calls the specified function [onBound] with `this` value
* as its receiver and returns the bound view root.