From fb23bda4d6fdd830bbd57f98ddf4a692ff4e8503 Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 7 Jul 2021 01:13:50 +0000 Subject: [PATCH] changes --- pages/contact.php | 8 +- pages/related.php | 15 ++ public/2020/index.php | 4 +- public/_v4/includes.php | 1 + public/key.php | 27 ++- public/ssh.php | 37 ++++ public/temp.php | 200 ++++++++++++++++++ public/tile-test.php | 0 .../userscripts/remove-trending-tab.user.js | 28 +-- 9 files changed, 294 insertions(+), 26 deletions(-) create mode 100644 public/ssh.php create mode 100644 public/temp.php create mode 100644 public/tile-test.php diff --git a/pages/contact.php b/pages/contact.php index 7b85374..c65c08a 100644 --- a/pages/contact.php +++ b/pages/contact.php @@ -126,10 +126,16 @@ if($reqPath === '/contact') { ], [ 'id' => 'nin-sw', - 'name' => 'Nintendo Switch', + 'name' => 'Nintendo Switch (EU)', 'icon' => 'fmi fmi-switch', 'display' => 'SW-7446-8163-4902', ], + [ + 'id' => 'nin-sw', + 'name' => 'Nintendo Switch (JP)', + 'icon' => 'fmi fmi-switch', + 'display' => 'SW-6001-2763-7822', + ], [ 'id' => 'nin-3ds', 'name' => 'Nintendo 3DS', diff --git a/pages/related.php b/pages/related.php index 5184aa1..45ded66 100644 --- a/pages/related.php +++ b/pages/related.php @@ -76,6 +76,21 @@ if($reqPath === '/related') { 'url' => 'https://devkitpro.org/', 'desc' => 'Amazing homebrew toolchains for Nintendo hardware.', ], + [ + 'name' => 'DeepL', + 'url' => 'https://www.deepl.com/translator', + 'desc' => 'A machine translator that doesn\'t exclusively produce garbage.', + ], + [ + 'name' => 'ImgOps', + 'url' => 'https://imgops.com/', + 'desc' => 'Provides quick links to various image reverse search utilities.', + ], + [ + 'name' => 'TETOMOMOWARP', + 'url' => 'https://aidn.jp/tetomomowarp/', + 'desc' => 'tet', + ], [ 'name' => 'Peppy\'s Windows XP Resources', 'url' => 'https://web.archive.org/web/20011202115409/xp.xyu.ca/', diff --git a/public/2020/index.php b/public/2020/index.php index f65e0fe..690a6f6 100644 --- a/public/2020/index.php +++ b/public/2020/index.php @@ -49,11 +49,11 @@ echo html_doctype(); - +
New blog script is still work in progress, enjoy the old version!
- +
diff --git a/public/_v4/includes.php b/public/_v4/includes.php index 222eb40..b1d9b26 100644 --- a/public/_v4/includes.php +++ b/public/_v4/includes.php @@ -29,6 +29,7 @@ try { ", ]); } catch(Exception $ex) { + http_response_code(500); echo '

Unable to connect to database

'; die($ex->getMessage()); } diff --git a/public/key.php b/public/key.php index f914983..5ce0a3b 100644 --- a/public/key.php +++ b/public/key.php @@ -1,6 +1,25 @@ 0 && $length < 1000) { + echo generateKey($length); + return; + } +} + +echo '16: ' . generateKey(8) . PHP_EOL; +echo '32: ' . generateKey(16) . PHP_EOL; +echo '64: ' . generateKey(32) . PHP_EOL; +echo '128: ' . generateKey(64) . PHP_EOL; diff --git a/public/ssh.php b/public/ssh.php new file mode 100644 index 0000000..ce9949f --- /dev/null +++ b/public/ssh.php @@ -0,0 +1,37 @@ +prepare('SELECT *, UNIX_TIMESTAMP(`key_created`) AS `key_created` FROM `fm_public_keys` WHERE `key_deprecated` IS NULL AND `key_level` >= :level'); +$keys->bindValue('level', $minLevel); +$keys->execute(); +$keys = $keys->fetchAll(PDO::FETCH_OBJ); + +if($json) { + $items = []; + + foreach($keys as $key) { + $items[] = $item = new stdClass; + $item->algo = $key->key_algo; + $item->key = $key->key_body; + if($includeComment) { + $item->comment = $key->key_comment; + $item->created = date(DateTime::ATOM, $key->key_created); + $item->level = $key->key_level; + } + } + + echo json_encode($items); +} else { + foreach($keys as $key) { + printf('ssh-%s %s', $key->key_algo, $key->key_body); + if($includeComment) + printf(' %s (%s)', $key->key_comment, date('M Y', $key->key_created)); + echo "\n"; + } +} diff --git a/public/temp.php b/public/temp.php new file mode 100644 index 0000000..65be17a --- /dev/null +++ b/public/temp.php @@ -0,0 +1,200 @@ +prepare('INSERT INTO `fm_temperature` (`temp_celcius`) VALUES (:temp)'); + $insert->bindValue('temp', (string)json_decode($temp)); + $insert->execute(); + return; +} + +if(isset($_GET['since'])) { + $since = (int)filter_input(INPUT_GET, 'since', FILTER_SANITIZE_NUMBER_INT); + $temps = $pdo->prepare('SELECT `temp_celcius`, UNIX_TIMESTAMP(`temp_datetime`) AS `temp_datetime` FROM `fm_temperature` WHERE `temp_datetime` > FROM_UNIXTIME(:since) AND `temp_datetime` > NOW() - INTERVAL 1 DAY ORDER BY `temp_datetime` ASC LIMIT 288'); + $temps->bindValue('since', $since); + $temps->execute(); + header('Content-Type: application/json; charset=utf-8'); + echo json_encode($temps->fetchAll(PDO::FETCH_ASSOC)); + return; +} + +if(!empty($_GET['siri'])) { + header('Content-Type: text/plain; charset=utf-8'); + $temps = $pdo->prepare('SELECT `temp_celcius`, UNIX_TIMESTAMP(`temp_datetime`) AS `temp_datetime` FROM `fm_temperature` ORDER BY `temp_datetime` DESC LIMIT 1'); + $temps->execute(); + $temps = $temps->fetch(PDO::FETCH_ASSOC); + printf('It was %2$.1f°C at %1$s.', date('H:i:s', $temps['temp_datetime']), $temps['temp_celcius']); + return; +} +?> + + + + + Room Temperature + + + + + +
+
+
+ -- °C +
+
+ --:--:-- +
+
+
+ +
+
+ + + + diff --git a/public/tile-test.php b/public/tile-test.php new file mode 100644 index 0000000..e69de29 diff --git a/public/userscripts/remove-trending-tab.user.js b/public/userscripts/remove-trending-tab.user.js index 064e935..dad92f5 100644 --- a/public/userscripts/remove-trending-tab.user.js +++ b/public/userscripts/remove-trending-tab.user.js @@ -1,28 +1,18 @@ // ==UserScript== // @name Removed Trending tab -// @version 1 +// @version 6 // @grant none // @include https://www.youtube.com/* // ==/UserScript== -window.addEventListener('load', () => { - const guideButton = document.getElementById('guide-button'), - appDrawer = document.querySelector('app-drawer'); - - if (appDrawer.getAttribute('opened') !== null) - removeTrendingButton(); - else - guideButton.addEventListener('click', () => removeTrendingButton()); - -}); - -function removeTrendingButton() { - const checkInterval = setInterval(() => { - const trendingButton = document.querySelector('[href="/feed/trending"]'); - - if (trendingButton) { - trendingButton.parentElement.remove(); +window.addEventListener('load', function() { + var checkInterval = setInterval(function() { + var buttons = Array.from(document.querySelectorAll('[href="/feed/explore"], [href="/feed/trending"]')); + + if(buttons.length) { + while(buttons.length) + buttons.pop().parentElement.remove(); clearInterval(checkInterval); } }, 100); -} +});