Skip to content

Instantly share code, notes, and snippets.

Avatar

Nabil Redmann BananaAcid

View GitHub Profile
@BananaAcid
BananaAcid / schule.hessen.de - Easy Login.user.js
Created Sep 4, 2022
remember username + fix/remove spaces in inserted 2FA key
View schule.hessen.de - Easy Login.user.js
// ==UserScript==
// @name schule.hessen.de - Fixes
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Remember User name, and fix spacings in inserted one-time-passwords (copied from Authy)
// @author Nabil Redmann
// @match https://owa.hessen.de/logon/LogonPoint/tmindex.html
// @icon https://www.google.com/s2/favicons?domain=hessen.de
// @grant none
// ==/UserScript==
View PhotoPea full width.user.js
// ==UserScript==
// @name PhotoPea full width
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Use full width - move the ad outside the viewport
// @author BananaAcid
// @match https://www.photopea.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=photopea.com
// @grant none
// ==/UserScript==
@BananaAcid
BananaAcid / package.json
Last active Sep 2, 2022
package json commands for dokku
View package.json
{
"name": "project_abc",
"private": true,
"config": {
"host": "hosting.server.tld",
"domain": "abc-project.tld"
},
"scripts": {
"local:createSshKey": "ssh-keygen -t rsa",
View add pub key to server.sh
# add user cert to root
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh root@server.tld "touch /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh root@server.tld "cat - >> /root/.ssh/authorized_keys"
# add user to dokku for git+push
cat ~/.ssh/id_rsa.pub | ssh root@hosting.texxolut.de "sudo sshcommand acl-add dokku $USER"
@BananaAcid
BananaAcid / add.js
Created Sep 1, 2022
add sripts and style and wait for them async to be loaded
View add.js
let add = (tag, url) => new Promise( (resolve) => {
let el = document.createElement(tag);
if (tag === 'link') { el.rel = 'stylesheet'; }
if (tag === 'link') {
el.href = url;
}
else if (tag === 'script') {
el.src = url;
}
@BananaAcid
BananaAcid / tunnel example.txt
Created Aug 22, 2022
Example on using a tunnel
View tunnel example.txt
having nodeJs installed allready ...
run each command on a new terminal
npx node-infopage
npx localtunnel --port 4567 --subdomain testitest
# npx ngrok http 4567
npx open-cli https://testitest.loca.lt/
@BananaAcid
BananaAcid / super-async-load.js
Created Aug 18, 2022
Load css & script with promises and wait till loaded
View super-async-load.js
let add = (tag, url) => new Promise( (resolve) => {
let el = document.createElement(tag);
if (tag === 'link') {
el.rel = 'stylesheet';
el.href = url;
}
else if (tag === 'script') {
el.src = url;
}
@BananaAcid
BananaAcid / inview.client.js
Last active Aug 11, 2022
inView Directive for Vue + Vue3
View inview.client.js
// Licence ISC
// global
let inited = !!(window as any).inview_scroll_targets;
let targets:[{el:HTMLElement, value:any}] = (window as any).inview_scroll_targets = (window as any).inview_scroll_targets || [];
function isElementOutViewport(el) {
let rect = el.getBoundingClientRect();
@BananaAcid
BananaAcid / directMethods.mjs
Last active Jul 22, 2022
couchDB - putSecurity() and getSecurity() using fetch #PouchDB
View directMethods.mjs
/**
Access CouchDB to get and update a security object using fetch
(does it directly, no pouchdb or alike needed. PouchDB CAN get a _security object but not set it).
Usage:
let con = 'http://admin:adminpw@localhost:5984/user-numberone';
let secDoc = await getSecurity(con);
secDoc.members = ['user_to_add'];
@BananaAcid
BananaAcid / init typescript project.sh
Last active Jul 16, 2022
npm: init typescript project
View init typescript project.sh
mkdir app
cd app
npm init -y
npm i -D typescript
npm i ts-node
node_modules/.bin/tsc --init
touch index.ts
# package.json ->
# "start": "node_modules/.bin/ts-node index.ts",