This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.width | |
import androidx.compose.foundation.lazy.LazyColumn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.text.Editable; | |
import android.text.Html; | |
import android.text.Spannable; | |
import android.text.Spanned; | |
import android.text.style.StrikethroughSpan; | |
import org.xml.sax.XMLReader; | |
public class DelTagHandler implements Html.TagHandler { | |
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2' | |
// for lifecycleScope: implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-rc02' | |
class MyFragment : Fragment() { | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
val request = Request.Builder().get() | |
.url("https://icanhazip.com") | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package eu.alessiobianchi | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
interface ItemClickListener<T> { | |
fun onClick(view: View, position: Int, item: T) | |
} | |
abstract class ClickableAdapter<T, V: ClickableViewHolder<T>>( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.applicationVariants.all { variant -> | |
tasks.create(name: "signatureHash${variant.name.capitalize()}", type: Exec) { | |
group "util" | |
commandLine 'keytool', '-exportcert', '-list', '-v', | |
'-alias', variant.signingConfig.keyAlias, | |
'-keypass', variant.signingConfig.keyPassword, | |
'-keystore', variant.signingConfig.storeFile, | |
'-storepass', variant.signingConfig.storePassword | |
doFirst { | |
println ":: Signing config for variant ${variant.name} is: ${variant.signingConfig.name}\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<android.support.constraint.ConstraintLayout | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# note: when debugging on PC/MAC, this script must be run with bash | |
# Custom AsusWRT DDNS script for AWS Route53 - v1.0 | |
# Author: Alessio Bianchi <[email protected]> | |
# Credits: http://czak.pl/2015/09/15/s3-rest-api-with-curl.html | |
ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX" | |
SECRET_ACCESS_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
# These keys can be associated to a IAM user with the following policy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fold() { | |
data="$1" | |
width="$2" | |
length=$(echo -n "$data" | wc -c) | |
while [ $length -gt $width ] | |
do | |
echo ${data:0:$width} | |
data=${data:$width} | |
length=$(echo -n "$data" | wc -c) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void validateCertificate(X509Certificate toVerify, X509Certificate root) throws Exception { | |
CertificateFactory cf = CertificateFactory.getInstance("X.509"); | |
CertPath cp = cf.generateCertPath(Collections.singletonList(toVerify)); | |
TrustAnchor trustAnchor = new TrustAnchor(root, null); | |
CertPathValidator cpv = CertPathValidator.getInstance("PKIX"); | |
PKIXParameters pkixParams = new PKIXParameters(Collections.singleton(trustAnchor)); | |
pkixParams.setRevocationEnabled(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.alessio.testapp; | |
import android.content.Context; | |
import android.content.pm.ApplicationInfo; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.security.cert.CertificateFactory; | |
import java.security.cert.X509Certificate; | |
import java.util.zip.ZipEntry; |
NewerOlder