Skip to content

Instantly share code, notes, and snippets.

@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"
@kopiro
kopiro / xhr_fetch_hook.js
Last active June 16, 2020 08:32
XHR / Fetch Hook - Log requests directly in the Dev Console
formatBody = (body) => { if (!body) return body; try { return JSON.parse(body); } catch (err) { return body; } };
XMLHttpRequest.prototype._open = XMLHttpRequest.prototype._open || XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this._openArgs = arguments;
return XMLHttpRequest.prototype._open.apply(this, arguments);
};
XMLHttpRequest.prototype._send = XMLHttpRequest.prototype._send || XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(body) {
@kopiro
kopiro / file.sh
Last active March 31, 2020 15:45
Configure Unattended Upgrades
apt-get -y install unattended-upgrades
dpkg-reconfigure --priority=low unattended-upgrades
@kopiro
kopiro / slack-multiple.scpt
Created September 23, 2019 12:20
Slack - Multiple channels message
set myChannels to {"random"} # Populate this field
set theResponse to display dialog "What's your message?" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set theMessage to text returned of theResponse
tell application "Slack"
activate
tell application "System Events"
repeat with theChannel in myChannels
@kopiro
kopiro / get-apple-id-email.sh
Last active June 19, 2019 12:39
Get Apple ID email in OSX
#!/bin/sh
dscl . readpl "/Users/$(whoami)" dsAttrTypeNative:LinkedIdentity "appleid.apple.com:linked identities:0:full name" | awk '{print $4}'
@kopiro
kopiro / AutoUpdater.vb
Created November 26, 2018 08:10
Auto Update VB.NET Compact 3.5 App
Public Class AutoUpdater
Public newVersion As String
Public urlOfCab As String
Public credentials As Net.NetworkCredential
Public askDest As Boolean = False
Public deleteCab As Boolean = True
Public useUI As Boolean = False
Public permitUninstall As Boolean = False
@kopiro
kopiro / README.md
Last active November 6, 2018 14:39
Extract from a JS object with a specific pattern

extractWithPattern

Extract from a JS object with a specific pattern

let msg = [
	{ payload: { errors: { unknown_language: 'hello' } } },
	{ payload: { errors: { number: 1 } } },
	{ randomstuff: 42 }
];
@kopiro
kopiro / backup-repos.sh
Last active October 15, 2018 10:39
Backup all Repositories in current directory
backup-repos() {
for i in $(find . -type d -maxdepth 1 -mindepth 1); do
echo "Looking in $i..."
if [ -d "$i/.git" ]; then
echo "Found repository in $i, init backup..."
pushd $i > /dev/null
zip_name="$i-$(date +'%y%m%d').zip"
zip_path="/opt/backups/$zip_name"
echo "ZIP path: $zip_path"
if [ ! -f "$zip_path" ]; then
@kopiro
kopiro / number_to_english.js
Created September 7, 2018 12:55
Number to English
const digit_to_string = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',