This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Utilities */ | |
var RANDOM = function() {}; | |
function _randomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function _randomHex(len) { | |
var hex = '0123456789abcdef'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |