Skip to content

Instantly share code, notes, and snippets.

@anzz1
anzz1 / buildconf.sh
Created May 24, 2023 22:40
buildconf.sh
#!/bin/sh
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, Daniel Stenberg, <[email protected]>, et al.
#
@anzz1
anzz1 / joaat.c
Created May 17, 2023 14:32
joaat
// joaat.c
#include <stdio.h>
unsigned long joaat_i(const unsigned char* s) {
unsigned long hash = 0;
while (*s) {
hash += ((*s>64&&*s<91)?((*s++)+32):*s++); // A-Z -> a-z
hash += (hash << 10);
hash ^= (hash >> 6);
@anzz1
anzz1 / gh-new-repo-101.md
Last active August 12, 2023 13:58
GitHub New Repo 101

GitHub New Repo 101

Main Page

https://github.com/USER/REPO/

Click the gear icon on the right sidebar next to "About".

Include in the home page

Uncheck everything you don't need to remove clutter.
When in doubt, uncheck. You can always recheck later.

Repo Rinse

This will blow away anything that is not committed.

git reset --hard
git submodule foreach --recursive 'git reset HEAD . || :'
git submodule foreach --recursive 'git checkout -- . || :'
git submodule update --init --recursive
git clean -d -f -f -x
git submodule foreach --recursive git clean -d -f -f -x
@anzz1
anzz1 / xldd.sh
Created May 2, 2023 02:22
xldd.sh
#!/bin/sh
xldd() { if [ -z "$1" ]; then echo 'xldd: usage: xldd <elf>'; else if [ -z "$CROSS_COMPILE" ]; then echo 'xldd: error: $CROSS_COMPILE not defined'; else if [ -x "$CROSS_COMPILE""readelf" ]; then echo "xldd: "$1""; "$CROSS_COMPILE""readelf" -d "$1" | grep "Shared library:"; else echo "xldd: error: "$CROSS_COMPILE""readelf" is not executable"; fi; fi; fi; }
@anzz1
anzz1 / .gitignore
Last active November 10, 2023 22:16
.gitignore
# Git
!/**/.gitkeep
!/**/.keep
# Object files
*.d
*.o
*.ko
*.obj
*.elf
@anzz1
anzz1 / time.sh
Created April 27, 2023 11:44
time.sh
#!/bin/sh
# dt=$(echo -ne "GET / HTTP/1.1\r\nHost: whatismyip.akamai.com\r\nAccept: text/plain\r\nConnection: close\r\n\r\n" | nc -w1 whatismyip.akamai.com 80 | awk -F': ' '/Date: /{print $2;exit}')
# t=$(date -d "$dt" +%s)
a=$((printf "c%47s" | nc -uw1 pool.ntp.org 123 | xxd -s40 -l4 -p) 2>/dev/null)
if [ ! -z "$a" ]; then
b=$((printf "%d" 0x$a) 2>/dev/null)
if [ "$b" -gt 2208988800 ] 2>/dev/null; then
t=$((0x$a-2208988800))
@anzz1
anzz1 / ip.sh
Created April 27, 2023 11:01
ip.sh
#!/bin/sh
ipvalid() {
if expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
return 0
fi
return 1
}
# IP=$(ifconfig wlan0 | grep -m1 'inet addr:' | cut -d: -f2 | cut -d' ' -f1)
@anzz1
anzz1 / gpt4x.cmd
Last active April 8, 2023 16:35
one-click-gpt4x
<# :
@echo off
cd /d "%~dp0"
md bin 2>nul
md models\gpt4-x-alpaca-13b-ggml 2>nul
md prompts 2>nul
if not exist "bin\wget.exe" (
powershell -nol -noni -nop -ex bypass -c "&{[ScriptBlock]::Create((cat '%~f0') -join [Char[]]10).Invoke()}"
)
if not exist "bin\main.exe" (
@anzz1
anzz1 / convert-pth-to-ggml.py
Last active March 29, 2023 13:26
ugly hardcoded hack for point-alpaca conversion
# Convert a LLaMA model checkpoint to a ggml compatible file
#
# Load the model using Torch
# Iterate over all variables and write them to a binary file.
#
# For each variable, write the following:
# - Number of dimensions (int)
# - Name length (int)
# - Dimensions (int[n_dims])
# - Name (char[name_length])