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
@kevinlekiller
kevinlekiller / CAS.glsl
Created February 8, 2022 03:38 — forked from agyild/CAS-scaled.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
@atyuwen
atyuwen / opt_fsr.fxh
Last active May 17, 2024 11:09
An optimized AMD FSR implementation for Mobiles
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/
// Distributed under the MIT License. Copyright (c) 2021 atyuwen.
// -- FsrEasuSampleH should be implemented by calling shader, like following:
// AH3 FsrEasuSampleH(AF2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; }
//==============================================================================================================================
void FsrEasuL(
out AH3 pix,
@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
@caisq
caisq / custom-layers-in-tensorflow-js-stateful-configurable-and-serializable.markdown
Last active May 8, 2023 00:46
Custom Layers in TensorFlow.js (Stateful, Configurable, and Serializable)
@jiemojiemo
jiemojiemo / gist:0f7768418d15aeb267ea457503d07611
Created May 17, 2018 07:11
Tensorflow Add Gaussian Noise
def add_gaussian_noise(image):
# image must be scaled in [0, 1]
with tf.name_scope('Add_gaussian_noise'):
noise = tf.random_normal(shape=tf.shape(image), mean=0.0, stddev=(50)/(255), dtype=tf.float32)
noise_img = image + noise
noise_img = tf.clip_by_value(noise_img, 0.0, 1.0)
return noise_img
@moneytoo
moneytoo / gist:87e3772c821cb1e86415
Created May 23, 2015 18:39
Efficiently invert bitmap on Android
public Bitmap invert(Bitmap src)
{
int height = src.getHeight();
int width = src.getWidth();
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
ColorMatrix matrixGrayscale = new ColorMatrix();