Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Coding like a pro

Leandro SQ LeandroSQ

💻
Coding like a pro
View GitHub Profile
@LeandroSQ
LeandroSQ / SSLPinning.kt
Last active Oct 21, 2021
Kotlin - SSL Pinning by certificate SHA1 fingerprint - Retrofit OkHttp3
View SSLPinning.kt
package quevedo.soares.leandro.ssl
import okhttp3.Connection
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.Protocol
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
import java.security.MessageDigest
import java.security.cert.Certificate
@LeandroSQ
LeandroSQ / Dynv6.py
Created Jul 25, 2021
A simple python script for updating DNS zones using IPv6 and Dynv6's REST API
View Dynv6.py
# Imports
import requests
import socket
import time
import traceback
import os
# Constants
ENDPOINT = "https://dynv6.com/api/update"
HOSTNAME = "....."
@LeandroSQ
LeandroSQ / DatabaseDump.kt
Created Jul 15, 2021
Dump Room/SQLite database to JSON on Android
View DatabaseDump.kt
import android.content.Context
import android.database.Cursor
import androidx.core.database.getBlobOrNull
import androidx.core.database.getStringOrNull
import androidx.room.RoomDatabase
import org.json.JSONArray
import org.json.JSONObject
private fun listTables(db: RoomDatabase): ArrayList<String> {
val buffer = arrayListOf<String>()
@LeandroSQ
LeandroSQ / Array benchmark.js
Created Mar 6, 2021
Javascript Map, ForI, ForOf, ForIn, ForEach and MapPromise benchmark
View Array benchmark.js
(() => {
function n() {
let length = Math.floor((Math.random() * 90) + 10);
let buffer = "";
for (let i = 0; i < length; i ++) {
let tmp = Math.floor(Math.random() * 26);
buffer += String.fromCharCode(65 + tmp);
}
return buffer;