Skip to content

Instantly share code, notes, and snippets.

@cjpais
cjpais / llava-surgery-1.6-hack.py
Created February 1, 2024 22:02
llava 1.6 hack
import argparse
import glob
import os
import torch
from safetensors import safe_open
from safetensors.torch import save_file
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", help="Path to LLaVA v1.5 model")
@cjpais
cjpais / typescriptreact.json
Last active January 20, 2022 01:54
shahruz nextjs snippets
{
"React Function Component": {
"prefix": "rfc",
"body": [
"import React from 'react'",
"",
"const ${name:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}} = () => {",
"\treturn (",
"\t\t<div className=\"${classname:${TM_FILENAME_BASE/(.*)/${1:/downcase}/}}\">",
"\t\t\t$0",
@cjpais
cjpais / infinite.md
Created October 27, 2021 00:36
Open Map Standard

uint256[]

uint256 layout;

Benefits: Supports infinitely large maps up to the gas limit Limitation: Doesn't use bytes as input, so the complexity to develop with could be more annoying without proper tooling

Solidity Helper Functions

@cjpais
cjpais / nextjs-snippets.code-snippets
Created September 1, 2021 14:26
@shahruz shared nextjs & react vscode snippets
{
"React Function Component": {
"prefix": "rfc",
"body": [
"import React from 'react'",
"",
"const ${name:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}} = () => {",
"\treturn (",
"\t\t<div className=\"${classname:${TM_FILENAME_BASE/(.*)/${1:/downcase}/}}\">",
"\t\t\t$0",
@cjpais
cjpais / index.js
Created August 16, 2021 20:39
Get OpenZeppelin Role Bytes
var ethers = require("ethers");
let role = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('MINTER_ROLE'));
console.log(role)
import urllib.request
import time
import random
while True:
try:
response = urllib.request.urlopen('https://apple.com/')
html = response.read()
except:
print("some error but graceful handling (aka ignoring)")
syntax enable
set backspace=2
set nu
set softtabstop=4
set shiftwidth=4
set expandtab
filetype indent on
set showmatch
set incsearch
set hlsearch

Keybase proof

I hereby claim:

  • I am sipjca on github.
  • I am cjpais (https://keybase.io/cjpais) on keybase.
  • I have a public key ASBB5Th6ka2BexYqP74sEFrHQc8GDICmzQ7k6rPR4tk2jwo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1HxHY1Z3ngHaG7qB6Ry3tpaaEjjjRXgcsf https://explorer.blockstack.org/address/1HxHY1Z3ngHaG7qB6Ry3tpaaEjjjRXgcsf