Skip to content

Instantly share code, notes, and snippets.

def j(a,c,e=0):
for g in a.split(";"):
if all(c.count(h)>=g.count(h)for h in g):
i=sum([int("1414144810022213A111440008"[ord(h)-97],16)for h in g])
if(i>e):e,f=i,g
print f
j("italia;informatica;reddit;dirette", "ddeeirtt")
j("infamatori;informati;firmanti;infarcito;informatica", "aacfiimnort")
@jacopo-j
jacopo-j / autodarkmode.sh
Created October 21, 2018 17:43
macOS Mojave auto dark mode
#!/bin/bash
set_mode() {
if [[ "$1" == "dark" ]]; then
osascript -e '
tell application id "com.apple.systemevents"
tell appearance preferences
if dark mode is false then
set dark mode to true
@jacopo-j
jacopo-j / CRC-8_MIFARE-MAD.py
Created February 18, 2020 10:00
Algorithm for calculating CRC-8 checksum for MIFARE Application Directory (MAD)
def checksum(data):
crc = 0xc7
for byte in data:
crc ^= byte
for _ in range(8):
msb = crc & 0x80
crc = (crc << 1) & 0xff
if msb:
crc ^= 0x1d
return bytes([crc])
@jacopo-j
jacopo-j / frida-spoof.js
Last active November 6, 2024 03:19
Frida script to spoof and hide several Android identifiers
/* Utilities */
var RANDOM = function() {};
function _randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function _randomHex(len) {
var hex = '0123456789abcdef';