Skip to content

Instantly share code, notes, and snippets.

View kepocnhh's full-sized avatar

Stanley Wintergreen kepocnhh

View GitHub Profile
@kepocnhh
kepocnhh / Math.kt
Created April 4, 2023 19:00
Get sum of geometric series.
// https://en.wikipedia.org/wiki/Geometric_series
/**
* a*r.pow(1) + a*r.pow(2) + a*r.pow(3) + a*r.pow(4) + ... + a*r.pow(n)
* 1*10 + 1*100 + 1*1_000 + 1*10_000 + ... + 1*10.pow(n)
*/
private fun getSumOfGeometricSeries(a: Int = 1, r: Double = 10.0, n: Int): Double {
return r * a * (1.0 - r.pow(n)) / (1.0 - r)
}
@kepocnhh
kepocnhh / build.sh
Last active March 30, 2023 12:03
Build docker image alpaca.cpp-9116ae9.
#!/bin/bash
rm ggml-alpaca-7b-q4.bin
curl https://gateway.estuary.tech/gw/ipfs/QmQ1bf2BTnYxq73MFJWu1B7bQ2UD6qG7D7YDCxhTndVkPC -o ggml-alpaca-7b-q4.bin
ISSUER='alpaca.cpp'
ISSUER_VERSION='9116ae9'
IMAGE_VERSION='1'
IMAGE_TAG="$ISSUER:${ISSUER_VERSION}-${IMAGE_VERSION}"
@kepocnhh
kepocnhh / Dockerfile
Created March 30, 2023 11:55
Docker image alpaca.cpp.
from amd64/debian:bullseye-20230320-slim
run apt-get update && apt-get upgrade -y
run apt-get install --no-install-recommends -y \
make build-essential curl ca-certificates unzip
run apt autoremove
arg VERSION
run curl -L https://github.com/antimatter15/alpaca.cpp/archive/refs/tags/${VERSION}.zip \
@kepocnhh
kepocnhh / aliases
Last active November 28, 2022 15:04
Debian .local/aliases
alias d='ls --almost-all --group-directories-first --indicator-style=slash -v -1'
@kepocnhh
kepocnhh / environment
Last active November 28, 2022 15:05
Debian .local/environment
PS1="\n┌ \[\033[01;34m\]\$(pwd)\]\e[0m\n└ $ "
@kepocnhh
kepocnhh / zip_tar.sh
Created November 25, 2022 16:41
Zip and tar folder.
#!/bin/bash
ISSUER='some_dir'
echo "
zip..."
rm "${ISSUER}.zip"
$(DIR="$(pwd)" && cd "$ISSUER" && zip -r9 "$DIR/${ISSUER}.zip" $(ls -A) > /dev/null) || exit 1 # todo
@kepocnhh
kepocnhh / speed.sh
Created September 1, 2022 15:40
bash network speed
#!/bin/bash
ADDRESS='8.8.8.8'
REGEX='(?<=time=)[1-9][0-9]*.[0-9]+'
BYTES=64
LINE=$(/usr/bin/ping -c1 -s $((BYTES - 8)) "$ADDRESS")
if test $? -ne 0; then
echo "Ping 1 error!"; exit 11
elif test -x "$LINE"; then
@kepocnhh
kepocnhh / login.md
Last active August 14, 2022 18:24
Linux login order

login

  • ~/.profile

xserver

    • ~/.xinitrc
      • ~/.xsessionrc

emulator

@kepocnhh
kepocnhh / Default.sublime-mousemap
Last active August 14, 2022 14:04
Sublime mousemap
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
},
{
"button": "button3",
@kepocnhh
kepocnhh / Default.sublime-keymap
Last active August 12, 2022 20:18
Sublime keymap
[
{ "keys": ["ctrl+shift+u"], "command": "upper_case" },
{ "keys": ["ctrl+shift+l"], "command": "lower_case" },
{ "keys": ["ctrl+d"], "command": "duplicate_line" }
]