Skip to content

Instantly share code, notes, and snippets.

View Mlocik97's full-sized avatar
🏠
Working from home

Mlocik97

🏠
Working from home
View GitHub Profile
@Mlocik97
Mlocik97 / 10ff_hack.js
Last active October 3, 2022 15:58
10ff.net hack
const overlayNode = document.getElementsByClassName("overlayer").item(0);
const timeout = 20;
const config = {
subtree: true,
characterData: true,
};
const layerObserver = new MutationObserver(mutated);
function mutated(mutations) {
@Mlocik97
Mlocik97 / README.md
Last active September 17, 2022 21:25
Compare SvelteKit `use:enhance` APIs
Type Old enhance Today's enhance Proposal
Simple result - script
import { invalidate } from '$app/navigation';
// this action (https://svelte.dev/tutorial/actions) allows us to
// progressively enhance a <form> that already works without JS
/**
* @param {HTMLFormElement} form
* @param {{
* pending?: ({ data, form }: { data: FormData; form: HTMLFormElement }) => void;
* error?: ({
* data,
* form,
@Mlocik97
Mlocik97 / hooks.js
Last active March 2, 2024 18:03
example (writen by hand, not tested) of auth in SvelteKit. (deprecated)
export async function handle({ event, resolve }) {
const cookies = await cookie.parse(event.request.headers.get('cookie') || '');
if (event.url.pathname == '/login') {
// skip verifying user, and allow to load website
const response = await resolve(event);
return response;
}
const user = DB.User.findOne({session: cookies.token});
import { build, files, version } from '$service-worker';
// https://github.com/microsoft/TypeScript/issues/11781 - this is needed for TS and ESLint
/// env serviceworker
const globalThis = /** @type {unknown} */ (self);
/// <reference no-default-lib="true"/>
/// <reference lib="es2020" />
/// <reference lib="WebWorker" />
const sw = /** @type {ServiceWorkerGlobalScope & typeof globalThis} */ (globalThis);
@Mlocik97
Mlocik97 / electron_open_link.svelte
Last active March 19, 2022 10:35
if you want to open link from electron app in browser.
@Mlocik97
Mlocik97 / navod.txt
Last active March 13, 2024 17:05
Nastavenie Linuxu
sudo ubuntu-drivers autoinstall
sudo fwupdmgr update
# pre tlačiareň ak je potreba
sudo apt-get install printer-driver-gutenprint
# smart logs for SSD:
sudo nvme smart-log /dev/nvme0
# Nastavenie SWAP po vytvorení SWAP partície
@Mlocik97
Mlocik97 / Readme.md
Last active June 9, 2022 19:16
PulseEffects preset for laptops microphones

NOTE: This preset is for PE version 4.7.x

Set microphone volume at 10% (-60dB).

Put file to ~/.config/PulseEffects/input

@Mlocik97
Mlocik97 / Readme.md
Last active February 25, 2021 12:56
Logitech Z333 & Z337 audio PulseEffects preset for music

NOTE: This preset is for PE version 4.7.x

Put files to ~/.config/PulseEffects/output

Preset was created primarly for Z333 & Z337 and also was tested on Z333, but probably/maybe can be used on any 2.1 speaker. Preset can be customized for Your needs and Your audio system.

Preset is focused primarly for music.

For best experience, I recommend to set subwoofer "volume" at half (50%), on back of Your subwoofer. Like on this image: Z333 Z337 Subwoofer Backend

@Mlocik97
Mlocik97 / discordeletessages.js
Created January 31, 2020 15:33
discord delete messages
(async function() {
const Authorization = ''; // past here AuthKey
const GET = { headers: { Authorization }, method: 'GET' };
const DELETE = { headers: { Authorization }, method: 'DELETE'};
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const me = await fetch('/api/v6/users/@me', GET)
.then(r => r.json())