Skip to content

Instantly share code, notes, and snippets.

View kepocnhh's full-sized avatar

Stanley Wintergreen kepocnhh

View GitHub Profile
@kepocnhh
kepocnhh / gpg_read.sh
Last active May 1, 2023 14:54
Copy to clipboard parsed decrypted.
#!/usr/local/bin/bash
if test $# -ne 2; then
echo "Script needs 2 arguments: ENCRYPTED, KEY. But actual is $#!"; exit 1; fi
ENCRYPTED="$1"
KEY="$2"
for it in ENCRYPTED KEY; do
if test -z "${!it}"; then echo "Argument \"$it\" is empty!"; exit 1; fi; done
@kepocnhh
kepocnhh / sign_jar_check.sh
Created April 30, 2023 17:18
Signature JAR check.
#!/usr/local/bin/bash
if test $# -ne 4; then
echo "Script needs 4 arguments: ISSUER, KEYSTORE, KEYSTORE_PASSWORD KEY_ALIAS. But actual is $#!"; exit 1; fi
KEYSTORE_TYPE='pkcs12'
ISSUER="$1"
KEYSTORE="$2"
KEYSTORE_PASSWORD="$3"
KEY_ALIAS="$4"
#!/bin/bash
VARIANT='snapshot'
gradle clean && \
gradle "lib:assemble${VARIANT}MavenMetadata" && \
gradle "lib:assemble${VARIANT}Jar" && \
gradle "lib:assemble${VARIANT}Pom"
if test $? -ne 0; then
// https://en.wikipedia.org/wiki/Geometric_series
/**
* @param a is coefficient
* @param r is the common ratio
* @return sum of a*r.pow(n) + a*r.pow(n - 1) + ... + a*r.pow(m - 1) + a*r.pow(m)
*/
fun getSumOfGeometricSeries(
a: Int = 1,
r: Double = 10.0,
@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