Skip to content

Instantly share code, notes, and snippets.

View BenjaminWegener's full-sized avatar
🙃
I may be slow to respond.

@BenjaminWegener BenjaminWegener

🙃
I may be slow to respond.
View GitHub Profile
@BenjaminWegener
BenjaminWegener / gist:94c3a293994b3050cff880c4f802fd62
Last active May 7, 2023 19:03
install alpaca (chatGPT) on android
#install termux from f-droid
#copy commands or just use the command:
# pkg install curl -y && curl -s https://gist.githubusercontent.com/BenjaminWegener/94c3a293994b3050cff880c4f802fd62/raw/92b1c7056764af7e8548f66b4412c0615da46175/gistfile1.txt | bash
termux-setup-storage
pkg update -y
pkg upgrade -y
pkg install wget build-essential cmake git -y
git clone https://github.com/antimatter15/alpaca.cpp
cd alpaca.cpp
@BenjaminWegener
BenjaminWegener / CAS.glsl
Created July 25, 2022 19:37 — forked from kevinlekiller/CAS.glsl
AMD's Contrast Adaptive Sharpening filter ported to mpv along with ReShade modifications
// LICENSE
// =======
// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
// -------
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// -------
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
@BenjaminWegener
BenjaminWegener / Install.txt
Created February 19, 2022 19:40
Nextcloud on android userland
-install userland from fdroid
-setup debian with ssh
-get wlan ip from android
-connect to ssh via putty/connectbot etc - port is 2022
sudo apt update -y
sudo apt install -y wget unzip mariadb-server mariadb-client php php-{cli,xml,zip,curl,gd,cgi,mysql,mbstring} apache2 libapache2-mod-php
sudo mysql
CREATE DATABASE nextcloud;
CREATE USER admin@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nextcloud.* TO admin@localhost;
@BenjaminWegener
BenjaminWegener / RPi-install-wifi.sh
Last active October 31, 2024 15:29 — forked from kmonsoor/RPi-install-wifi.sh
install wifi adapter drivers on Raspberry Pi; origin: http://www.fars-robotics.net/install-wifi
#!/bin/bash
#set -e
# install-wifi - 03/05/2021 - by MrEngman.
UPDATE_SELF=${UPDATE_SELF:-1}
UPDATE_URI="http://downloads.fars-robotics.net/wifi-drivers/install-wifi"
ROOT_PATH=${ROOT_PATH:-"/"}
WORK_PATH=${WORK_PATH:-"${ROOT_PATH}/root"}

Install armhf debian system on qemu

Environment

Operation system: Raspbery Pi OS (Debian 10)

QEMU emulator version: 2+

Installation

@BenjaminWegener
BenjaminWegener / entfox.py
Last active November 1, 2022 11:28 — forked from justheuristic/entfox.py
updated for > tf2.0
import tensorflow as tf
def entmax15(inputs, axis=-1):
"""
Entmax 1.5 implementation, heavily inspired by
* paper: https://arxiv.org/pdf/1905.05702.pdf
* pytorch code: https://github.com/deep-spin/entmax
:param inputs: similar to softmax logits, but for entmax1.5
:param axis: entmax1.5 outputs will sum to 1 over this axis
:return: entmax activations of same shape as inputs
@BenjaminWegener
BenjaminWegener / attention_layer_tfjs
Created April 14, 2021 18:02
Causal Attention Layer Tensorflow.js
//---------------------------------------------------
//setup
var dModel = 256; //dimension of embedding
var INPUTSIZE = 1024; //length of input
var BLOCKS = 3;
var LEARNING_RATE = 0.003;
var OPTIMIZER = tf.train.adam(LEARNING_RATE, beta_1 = 0.85, beta_2 = 0.9, epsilon = 1e-9);
var LOSS = 'categoricalCrossentropy';
var INITIALIZER = 'GlorotUniform';
@BenjaminWegener
BenjaminWegener / bpe.js
Created December 15, 2020 15:43 — forked from atdt/bpe.js
var assert = require( 'assert' );
function findFrequentBigram( s ) {
var i, freqs = {}, topFreq = 0, topPair = null, bigram;
for ( i = 0; i < s.length; i += 2 ) {
bigram = s.slice( i, i + 2 );
freq = ++freqs[bigram];
@BenjaminWegener
BenjaminWegener / colab.js
Last active December 18, 2019 04:50
auto reconnect google colab bookmarklet
javascript:(function(){
console.log("Working");
document.querySelector("colab-toolbar-button#connect").click()
}.setInterval(60000))
@BenjaminWegener
BenjaminWegener / sub_pixel_conv.py
Created December 6, 2019 10:35
Keras only 2x pixel-shuffle / sub_pixel_conv
def sub_pixel_conv(inputs, height, width, out_channels): #keras version of 2x pixel shuffle
x = inputs
x = SeparableConv2D(out_channels * 4, kernel_size = 9, depth_multiplier = 1, activation = 'tanh', padding = 'same')(x)
x = Reshape((height, width, out_channels, 2, 2))(x)
x = Permute((3, 2, 4, 1, 5))(x)
x = Reshape((out_channels, height * 2, height * 2))(x)
x = Permute((2, 3, 1))(x)
return x