Skip to content

Instantly share code, notes, and snippets.

View ademar111190's full-sized avatar
Lightning Networking the Bitcoin

Ademar ademar111190

Lightning Networking the Bitcoin
  • CEO of Bitcoin
  • Itatiba
View GitHub Profile
@ademar111190
ademar111190 / Either.kt
Last active April 22, 2024 11:17
An Either implementation in kotlin
package functional
sealed class Either<L, R> {
abstract fun fold(left: (L) -> Unit, right: (R) -> Unit)
abstract fun <ML> mapLeft(f: (L) -> ML): Either<ML, R>
abstract fun <MR> mapRight(f: (R) -> MR): Either<L, MR>
@ademar111190
ademar111190 / levenshtein.kt
Last active March 5, 2024 10:53
Levenshtein Distance algorithm implementation using Kotlin
import kotlin.math.min
fun levenshtein(lhs : CharSequence, rhs : CharSequence) : Int {
if(lhs == rhs) { return 0 }
if(lhs.isEmpty()) { return rhs.length }
if(rhs.isEmpty()) { return lhs.length }
val lhsLength = lhs.length + 1
val rhsLength = rhs.length + 1
@ademar111190
ademar111190 / fontsize.dart
Created January 15, 2024 12:45
Font size experiment
class BAT extends StatelessWidget {
final double fontSize;
const BAT({
super.key,
required this.fontSize,
});
@override
Widget build(BuildContext context) {
@ademar111190
ademar111190 / handbreak.sh
Created October 2, 2023 16:57
Reduce the size of a video (handbreak does better)
#!/usr/bin/env bash
filename=$(basename -- "$1")
filename="${filename%.*}"
ffmpeg -i $1 -vcodec libx265 -crf 30 ${filename}-min.mp4
@ademar111190
ademar111190 / reduce.sh
Created September 28, 2023 16:31
Reduce a video file size with ffmpeg
ffmpeg -i input.xyz -vcodec libx265 -crf 30 output.mp4
@ademar111190
ademar111190 / gist:3224223
Created August 1, 2012 06:21
prolog sudoku solver
:- use_module(library(bounds)).
:- use_module(library(clp_distinct)).
suudoku(P) :-
Rows = [R1,R2,R3,R4,R5,R6,R7,R8,R9],
problem(P, Rows),
append_all(Rows, Vars),
vars_in(Vars, 1, 9),
Vars in 1..9,
row_constraint(Rows),
@ademar111190
ademar111190 / AndroidManifest.xml
Created December 3, 2020 11:52
Disable all uses feature
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- region hardware -->
<!-- Audio -->
<uses-feature
android:name="android.hardware.audio.low_latency"
android:required="false" />
<uses-feature
android:name="android.hardware.audio.output"
@ademar111190
ademar111190 / umbrel.dockerfile
Created March 18, 2023 16:07
Just a docker file to create an umbrel distrobox
FROM docker.io/library/ubuntu:22.10
# distrobox stuff
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt upgrade -y; \
apt-get install -y \
bash \
apt-utils \
bc \
@ademar111190
ademar111190 / autherror.diff
Created March 16, 2023 12:46
Auth error diff
diff --git a/android/app/src/main/java/com/breez/client/plugins/breez/breezlib/GoogleAuthenticator.java b/android/app/src/main/java/com/breez/client/plugins/breez/breezlib/GoogleAuthenticator.java
index 52319507..0b05f5b8 100644
--- a/android/app/src/main/java/com/breez/client/plugins/breez/breezlib/GoogleAuthenticator.java
+++ b/android/app/src/main/java/com/breez/client/plugins/breez/breezlib/GoogleAuthenticator.java
@@ -90,22 +90,8 @@ public class GoogleAuthenticator implements PluginRegistry.ActivityResultListene
} catch (Exception e) {
Log.w(TAG, "getAccessToken failed", e);
if (e instanceof UserRecoverableAuthException) {
- Log.w(TAG, "getAccessToken failed but it is recoverable, trying to sign in again");
- GoogleSignInAccount signInResult = Tasks.await(signIn());
@ademar111190
ademar111190 / SearchViewFormatter.java
Last active March 16, 2023 10:44
An easy way to format SearchView's
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SearchView;
import android.widget.TextView;