Skip to content

Instantly share code, notes, and snippets.

Avatar
🚂
Compiling Kotlin in a low-end device likens to boiling it

Muntashir Al-Islam MuntashirAkon

🚂
Compiling Kotlin in a low-end device likens to boiling it
View GitHub Profile
@MuntashirAkon
MuntashirAkon / extract_pubkey_hash.sh
Created May 5, 2022
Get Base64 encoded SHA-256 checksum of a public key from a DER encoded certificate. This is useful for creating certificate pinning on Android. See https://developer.android.com/training/articles/security-config#CertificatePinning
View extract_pubkey_hash.sh
#!/usr/bin/env bash
if [[ "$(uname)" == "Darwin" ]]; then
alias sha256sum="shasum -a 256"
fi
function extract_pubkey_hash() {
openssl x509 -inform der -in "$1" -pubkey -noout | sed -e 's/-----BEGIN PUBLIC KEY-----//' -e 's/-----END PUBLIC KEY-----//' | tr '\n' ',' | sed s/,//g | base64 -d | sha256sum - | awk '{ print $1 }' | xxd -r -p | base64
}
View hexify.cpp
// Get a byte array as a hexadecimal character string
int hexify(const uint8_t *in, size_t in_size, char *out, size_t out_size) {
if (in_size == 0 || out_size == 0) return 0;
char map[16+1] = "0123456789ABCDEF";
int bytes_written = 0;
size_t i = 0;
while(i < in_size && (i*2 + (2+1)) <= out_size)
{
@MuntashirAkon
MuntashirAkon / ECDH.java
Last active May 21, 2021 — forked from zcdziura/Crypto Test
Encryption using Elliptic Curves and Diffie-Hellman key exchanges
View ECDH.java
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
@MuntashirAkon
MuntashirAkon / delete_tweet.js
Created May 3, 2020
Delete all tweets from twitter
View delete_tweet.js
// NOTE: This script is far from complete, especially “Likes” section
// https://stackoverflow.com/a/2706236/4147849
function eventFire(el, etype) {
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
@MuntashirAkon
MuntashirAkon / mmssms_to_qksms.php
Created Apr 25, 2020
Convert mmssms.db to QKSMS compatible json file
View mmssms_to_qksms.php
<?php
if(!isset($argv[1])){
echo "USAGE: ${argv[0]} <mmssms.db file>\n";
exit(1);
}
$db_file = $argv[1];
$db = new SQLite3($db_file);
$stmt = $db->prepare("SELECT * FROM sms");
@MuntashirAkon
MuntashirAkon / guide.md
Last active Nov 2, 2019
Guide to enable macOS Terminal to respect system proxy
View guide.md

Copy and paste the code below at the beginning of ~/.bash_profile.

export http_proxy=`scutil --proxy | awk '\
  /HTTPEnable/ { enabled = $3; } \
  /HTTPProxy/ { server = $3; } \
  /HTTPPort/ { port = $3; } \
  END { if (enabled == "1") { print "http://" server ":" port; } }'`
export HTTP_PROXY="${http_proxy}"
export https_proxy=`scutil --proxy | awk '\
@MuntashirAkon
MuntashirAkon / ebooksites.txt
Created Jul 9, 2019
Deceptive Ebook Sites (Can be used with Adblock)
View ebooksites.txt
||playperks.net
||allbookserve.org
||bookfreenow.com
||pdfsu.online
||akeybooks.com
||outofprint.cc
||get-ebooks.club
||mybooklibrary.com
||iread-now.com
||recmedia.me
View disablespindump.sh
#!/bin/bash
#
# disablespindump
# Script to disable spindump
#
# (c) Muntashir Al-Islam
# License: MIT License
#
View littlesnitchtoggler.sh
#!/bin/bash
#
# LittleSnitchToggler
# Script to enable/disable Little Snitch
# (c) Muntashir Al-Islam
# License: MIT License
#
# Alert if not a root user