Skip to content

Instantly share code, notes, and snippets.

Avatar

Flavio De Stefano kopiro

View GitHub Profile
@kopiro
kopiro / Configuration.h
Last active Nov 9, 2022
Artillery Hornet with BLTouch Probe - Marlin 2.1.1
View Configuration.h
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
View var-lib-webosbrew-init.d-50-custom-screensavef
#!/bin/sh
set -e -o pipefail
MOUNT_TARGET="/usr/palm/applications/com.webos.app.screensaver/qml/main.qml"
QML_PATH="$(dirname "$(realpath "$0")")/screensaver-main.qml"
if [[ ! -f "$MOUNT_TARGET" ]]; then
echo "[-] Target file does not exist: $MOUNT_TARGET" >&2
exit 1
@kopiro
kopiro / nQueenBT.js
Created Sep 14, 2022
N-Queen with Backtrack
View nQueenBT.js
function printBoard(board, method = "log") {
console[method](board.map((e) => e.join("")).join("\n"));
}
function createDiagonalMatrix(_) {
_.takenDiagonal = [];
_.diagonalMatrix = new Array(_.n).fill().map(() => new Array(_.n).fill(-1));
// first row
for (let y = 0; y < _.n; y++) {
@kopiro
kopiro / README.md
Created May 6, 2022 — forked from Informatic/README.md
openlgtv webOS hacking notes
View README.md

This is just a dump of some interesting undocumented features of webOS (3.8 specifically, on early 2018 4k LG TV) and other development-related tips.

Homebrew app ideas

@kopiro
kopiro / defaults_diff.sh
Last active May 16, 2022
Get notification when preference from `defaults` change
View defaults_diff.sh
cmd="defaults read"; left=$(eval $cmd); while true; do right=$(eval $cmd); diff <( printf '%s' "$left") <( printf '%s' "$right"); left="$right"; sleep 1; done
@kopiro
kopiro / TeliaWidget.js
Last active Jan 10, 2022
Telia Scriptable widget
View TeliaWidget.js
// icon-color: purple; icon-glyph: newspaper;
/*
Telia Scriptable widget
Version: 0.0.1
You need to know your subscription ID from your Telia Plan
and grab a session cookie by logging in into the mobile-app
@kopiro
kopiro / telia_gb_left.sh
Last active Jan 14, 2022
Telia GB Left (XBar)
View telia_gb_left.sh
#!/bin/bash
# <xbar.title>Telia GB Left</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Flavio De Stefano</xbar.author>
# <xbar.author.github>kopiro</xbar.author.github>
# <xbar.var>string(SESSID=""): Session ID</xbar.var>
# <xbar.var>string(SUBSCRIPTION_ID=""): Subscription ID; if left blank, the first subscription found is gonna be used</xbar.var>
headers='-H "Accept: application/json" -H "X-IOS-Build: 4068" -H "ga-av: 10.10.4" -H "ga-aid: com.teliasonera.selfservice.telia" -H "User-Agent: com.teliasonera.selfservice.telia/10.10.4 (iOS 15.2; Apple)" -H "ga-an: Mitttelia"'
@kopiro
kopiro / atv4-kopiro.sh
Last active Mar 9, 2022
Aerial TV on Raspberry PI
View atv4-kopiro.sh
#!/bin/bash
set -x
[[ $EUID -eq 0 ]] && {
echo "Do not run this as the root user"
exit 1
}
[[ -z "$XDG_CONFIG_HOME" ]] &&
View bestTravel.js
/**
* Helper to sum an array
*/
function sum(array) {
return array.reduce((carry, e) => (carry += e), 0);
}
/**
* This procedure will build all possible combinations of K elements by making sure we never go into the
* branches where the sum of the sub-list is greater than T.
View geoguessr_flag_replacer.js
const CCC = [{"name":"Afghanistan","alpha-2":"AF","country-code":"004"},{"name":"Åland Islands","alpha-2":"AX","country-code":"248"},{"name":"Albania","alpha-2":"AL","country-code":"008"},{"name":"Algeria","alpha-2":"DZ","country-code":"012"},{"name":"American Samoa","alpha-2":"AS","country-code":"016"},{"name":"Andorra","alpha-2":"AD","country-code":"020"},{"name":"Angola","alpha-2":"AO","country-code":"024"},{"name":"Anguilla","alpha-2":"AI","country-code":"660"},{"name":"Antarctica","alpha-2":"AQ","country-code":"010"},{"name":"Antigua and Barbuda","alpha-2":"AG","country-code":"028"},{"name":"Argentina","alpha-2":"AR","country-code":"032"},{"name":"Armenia","alpha-2":"AM","country-code":"051"},{"name":"Aruba","alpha-2":"AW","country-code":"533"},{"name":"Australia","alpha-2":"AU","country-code":"036"},{"name":"Austria","alpha-2":"AT","country-code":"040"},{"name":"Azerbaijan","alpha-2":"AZ","country-code":"031"},{"name":"Bahamas","alpha-2":"BS","country-code":"044"},{"name":"Bahrain","alpha-2":"BH","count