Skip to content

Instantly share code, notes, and snippets.

import base64
import json
import socket
import math
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("socket.cryptohack.org", 13370))
data = s.recv(9)
mappina = []
@kopiro
kopiro / nef-to-jpg.sh
Created February 3, 2021 16:03
NEF to JPG converter
mkdir -p ./JPG
find . -name "*.NEF" -print0 | xargs -0 -P "$(sysctl -n hw.ncpu)" -I file sips -s format jpeg file --out ./JPG/file.jpg
@kopiro
kopiro / README.md
Last active April 10, 2022 20:57
RATV - RetroPie Apple TV
@kopiro
kopiro / git-oncommits.sh
Last active February 3, 2021 16:00
GIT notifications
#!/bin/bash
# For Windows, install https://github.com/Windos/BurntToast first
# Setup
PROJECT_DIR=~/Desktop/test-git
BRANCH_NAME="main"
CHECK_SEC=30
# End setup
@kopiro
kopiro / atv-emulator.sh
Last active December 19, 2020 15:51
Apple TV on Raspberry PI emulator
#!/bin/bash
pkill -f rpiplay
pkill -f simple-atv-aerial
rpiplay -n Mela -a hdmi -b auto -I &
simple-atv-aerial &
connected=0
/**
* Return a table string representation of the matrix
* @param {Array} matrix The matrix
* @param {String} prop The property to print
*/
function stringifyMatrix(matrix, prop = "originalValue") {
return matrix
.map((e) => e.map((e) => (prop === "" ? String(e) : e[prop])))
.join("\n")
.replace(/\,/g, " ");
@kopiro
kopiro / permutations.js
Last active February 25, 2021 14:48
UNIQUE Permutations ES6 Generators
const permutations = function*(elements, map = new Map()) {
if (elements.length === 1) {
yield elements;
} else {
const [first, ...rest] = elements;
for (const perm of permutations(rest, map)) {
for (let i = 0; i < elements.length; i++) {
const start = perm.slice(0, i);
const rest = perm.slice(i);
const val = [...start, first, ...rest];
@kopiro
kopiro / sync-code-projects.sh
Created October 7, 2020 17:50
Sync your ~/Projects directories with VSCode Project Manager extension
sync-code-projects() {
CODE_PROJECTS_FILE="$HOME/Library/Application Support/Code/User/projects.json" && \
echo "[" > "$CODE_PROJECTS_FILE" && \
find ~/Projects \
-maxdepth 1 \
-type d \
-execdir echo "{ \"name\": \"{}\", \"rootPath\": \"$HOME/Projects/{}\", \"enabled\": true }," >> "$CODE_PROJECTS_FILE" \; &&
echo "{}]" >> "$CODE_PROJECTS_FILE"
}
@kopiro
kopiro / fb-photo-album-download.js
Last active February 2, 2023 06:21
Download all the photos of a Facebook Album / "Photos of you"
/*
Download all the photos of a Facebook Album / "Photos of you"
If you want to download "the photos that you uploaded",
use the simpler "Your Facebook Information" feature on https://www.facebook.com/settings?tab=your_facebook_information
This script is only useful to download the photos you've been tagged into
You can find this page on: https://www.facebook.com/photos
Make sure you scroll 'til the end of the page, and then paste it into the console
@kopiro
kopiro / yarn-x.sh
Last active July 29, 2020 13:27
Yarn run fuzzy matching
pkgj-run-list() {
jq .scripts package.json | grep -o '.*\":' | sed -nE 's/\"(.*)\":/\1/p' | awk '{$1=$1};1' | fzf | tr -d '\r' | tr -d '\n'
}
yarn-x() {
PKG_CMD=$(pkgj-run-list)
[ -n "$PKG_CMD" ] && print -s "yarn $PKG_CMD" && yarn "$PKG_CMD"
}
alias yx="yarn-x"