Skip to content

Instantly share code, notes, and snippets.

View luciopaiva's full-sized avatar
🐌
I may be slow to respond

Lucio Paiva luciopaiva

🐌
I may be slow to respond
View GitHub Profile
@luciopaiva
luciopaiva / android-apk-user-certificates.md
Last active April 18, 2024 07:46
Android APK HTTPS user certificates how-to

Android APK HTTPS user certificates how-to

Starting with Android Nougat, Google changed the way apps handle user certificates:

Apps that target API Level 24 and above no longer trust user or admin-added CAs for secure connections, by default.

This means that certificates issued by applications like [Charles][charles] or [mitmproxy][mitmproxy] are no longer accepted, so these proxies won't work for HTTPS traffic.

This tutorial explains what needs to be done to overcome that restriction and be able to sniff any Android app's HTTPS requests.

@luciopaiva
luciopaiva / android-apk-hacking-how-to.md
Last active April 18, 2024 07:46
Android APK hacking how-to

Android APK hacking how-to

Install and configure SDK

  • install Android Studio (google it)

  • configure your shell (considering Linux+Bash):

    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools
    

export PATH=$PATH:$ANDROID_HOME/platform-tools

@luciopaiva
luciopaiva / changes-between-commits.md
Created October 10, 2018 16:14
Inspecting changes between commits in git

List files touched:

git diff --stat commit-1 commit-2

List change counts:

git diff --shortstat commit-1 commit-2 | cat

List authors between two commits:

@luciopaiva
luciopaiva / file-drop-zone.js
Last active September 7, 2018 00:30
File drop zone
class FileDropZone {
/**
* @param {HTMLElement|String} dropZoneElement
*/
constructor (dropZoneElement) {
dropZoneElement = typeof dropZoneElement === "string" ? document.getElementById(dropZoneElement) : dropZoneElement;
dropZoneElement.addEventListener("drop", this.onDrop.bind(this));
dropZoneElement.addEventListener("dragover", event => event.preventDefault());
@luciopaiva
luciopaiva / walksync.js
Last active October 29, 2020 20:24 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
#!/usr/bin/env node
const
path = require("path"),
fs = require("fs");
/**
* List all files in a directory recursively in a synchronous fashion
*
* @param {String} dir
@luciopaiva
luciopaiva / async-experiments.js
Created June 10, 2018 00:02
Async Javascript experiments
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
/**
* Shows how a timer fails to execute when we block the main thread. See `setIntervalDoesNotWorkWithBlockingWait()` for
* a solution to this.
* @returns {void}
*/
@luciopaiva
luciopaiva / ssh config key selection issues.md
Created May 22, 2018 22:38
ssh config key selection issues

Example .ssh/config file:

# severals rules that depend on the wildcard rule at the bottom

Host foo.com
    HostName foo.com
    User foo
    IdentityFile /path/to/id-1
@luciopaiva
luciopaiva / CSS Flexbox notes.md
Last active May 6, 2018 17:25
CSS Flexbox notes.md

Quick Guide to Flexbox

Flex container

display: flex;
flex-direction: row | column;
/* main axis alignment: */
justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly;
/* cross axis alignment: */

align-items: flex-start | flex-end | center | baseline | stretch;

@luciopaiva
luciopaiva / sleep.js
Created May 3, 2018 23:32
Javascript: sleep()
/**
* Asynchronously sleep for the specified amount of time.
* @param {Number} millis
* @return {Promise}
*/
function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
@luciopaiva
luciopaiva / ajax.js
Created May 3, 2018 23:30
Javascript: AJAX helper functions
async function getJson(url) {
return JSON.parse(await getFile(url));
}
async function getFile(url) {
return new Promise((resolve, reject) => {
const request = new XMLHttpRequest();
request.addEventListener("load", function () {
try {
resolve(this.responseText);