Skip to content

Instantly share code, notes, and snippets.

View LeandroSQ's full-sized avatar
💻
Coding like a pro

Leandro SQ LeandroSQ

💻
Coding like a pro
View GitHub Profile
@LeandroSQ
LeandroSQ / Array benchmark.js
Created March 6, 2021 20:46
Javascript Map, ForI, ForOf, ForIn, ForEach and MapPromise benchmark
(() => {
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;
@LeandroSQ
LeandroSQ / DatabaseDump.kt
Created July 15, 2021 01:05
Dump Room/SQLite database to JSON on Android
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 / Dynv6.py
Created July 25, 2021 17:46
A simple python script for updating DNS zones using IPv6 and Dynv6's REST API
# Imports
import requests
import socket
import time
import traceback
import os
# Constants
ENDPOINT = "https://dynv6.com/api/update"
HOSTNAME = "....."
@LeandroSQ
LeandroSQ / SSLPinning.kt
Last active October 21, 2021 12:43
Kotlin - SSL Pinning by certificate SHA1 fingerprint - Retrofit OkHttp3
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