Skip to content

Instantly share code, notes, and snippets.

Lucio Paiva luciopaiva

Block or report user

Report or block luciopaiva

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View witchcraft-include-directive-example.js
// @include my-script.js
// @include "some other script.js"
setup(); // `setup` is defined in `my-script.js`
luciopaiva /
Last active Oct 14, 2018
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 /
Last active Oct 14, 2018
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 /
Created Oct 10, 2018
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:

View file-drop-zone.js
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 / walksync.js
Last active Mar 30, 2019 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
View walksync.js
#!/usr/bin/env node
path = require("path"),
fs = require("fs");
* List all files in a directory recursively in a synchronous fashion
* @param {String} dir
luciopaiva / async-experiments.js
Created Jun 10, 2018
Async Javascript experiments
View async-experiments.js
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}
View ssh config key selection

Example .ssh/config file:

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

    User foo
    IdentityFile /path/to/id-1
luciopaiva / CSS Flexbox
Last active May 6, 2018
CSS Flexbox
View CSS Flexbox

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 / sleep.js
Created May 3, 2018
Javascript: sleep()
View sleep.js
* Asynchronously sleep for the specified amount of time.
* @param {Number} millis
* @return {Promise}
function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
You can’t perform that action at this time.