Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alashov Berkeli alashow

🏠
Working from home
View GitHub Profile
@demixdn
demixdn / EditTextDebounce.java
Created Apr 24, 2017
Get text from EditText with debounce without RxJava
View EditTextDebounce.java
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.lang.ref.WeakReference;
@tsabat
tsabat / zsh.md
Last active May 12, 2021
Getting oh-my-zsh to work in Ubuntu
View zsh.md

Prereq:

apt-get install zsh
apt-get install git-core

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active May 6, 2021
Destroy all Docker Containers and Images
View docker-destroy-all.sh
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@T0MM0R
T0MM0R / haproxy.cfg
Last active Apr 26, 2021 — forked from thisismitch/haproxy.cfg
Let's Encrypt Auto-Renewal script for HAProxy
View haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active Apr 24, 2021
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
View MyApp.java
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@ishikawa
ishikawa / gist:88599
Created Apr 1, 2009
Java Sample Code for Calculating HMAC-SHA1 Signatures
View gist:88599
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@radoyankov
radoyankov / Example.kt
Last active Apr 4, 2021
Easy Spannable on Kotlin
View Example.kt
val spanned = spannable{ bold("some") + italic(" formatted") + color(Color.RED, " text") }
val nested = spannable{ bold(italic("nested ")) + url("www.google.com", "text") }
val noWrapping = bold("no ") + sub("wrapping ) + sup("also ") + "works"
text_view.text = spanned + nested + noWrapping
@ditn
ditn / DynamicMeshNetwork.kt
Created Sep 30, 2020
Dynamic Mesh Network animation in Compose
View DynamicMeshNetwork.kt
private val PARTICLE_COLOR = Color.White
private val LINE_COLOR = Color.White
private const val PARTICLE_QUANTITY = 100
private const val DEFAULT_SPEED = 2
private const val VARIANT_SPEED = 1
private const val DEFAULT_RADIUS = 4
private const val VARIANT_RADIUS = 2
private const val LINK_RADIUS = 200
// TODO: 30/09/2020 These should be measured but are only used to calculate
// the initial position
@Antarix
Antarix / UrlImageParser.java
Created Nov 29, 2012
UrlImage Parser for android TextView to load Html Image tag
View UrlImageParser.java
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Context;
import android.graphics.Canvas;
@webile-android
webile-android / MainActivity.java
Created Jul 6, 2011
An android activity which demonstrates picking a photo from gallery and uploading it to a remote server.
View MainActivity.java
package com.webile.upload;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.util.Date;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;