Skip to content

Instantly share code, notes, and snippets.

View BananaAcid's full-sized avatar

Nabil Redmann BananaAcid

View GitHub Profile
@BananaAcid
BananaAcid / Readme.md
Created February 10, 2025 11:57
HTTPie cert error

Make python use system certificates

python -m pip install pip-system-certs

Error was:

https: error: SSLError: HTTPSConnectionPool(host='wikipedia.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1018)'))) while doing a GET request to URL: https://wikipedia.com/

@BananaAcid
BananaAcid / Readme.md
Created January 23, 2025 15:31
VUE: access each element in default slot

MyElement.vue

<template v-for="item in $slots.default?.()" :key="item">
  <p>
    <component :is="item" /> <!-- wrapps all child elements in default slot -->
  </p>
</template>

main.vue

@BananaAcid
BananaAcid / Readme.md
Last active January 21, 2025 14:45
Setup for Web Testing (Puppeteer)
  1. download nodeJS
  2. create empty folder, open it with vscode
  3. vscode -> terminal
  4. npm init
  5. npm i puppeteer tsx

create a index.ts:

@BananaAcid
BananaAcid / imap-auth.mjs
Created October 25, 2024 16:48
IMAP Auth for nodejs
// npm install imapflow
import { ImapFlow } from 'imapflow';
const config = {
host: 'ethereal.email',
port: 993,
secure: true,
auth: {}
};
@BananaAcid
BananaAcid / session_handling.txt
Created October 10, 2024 12:24
Nuxt session handling
/composables/useSess.ts
import {useSession} from h3
export default useSess(event)
return useSession(event, useRunimeConfig().session);
/nuxt.config.ts
@BananaAcid
BananaAcid / callFnInThread.js
Last active October 5, 2024 19:51
create an in-memory worker by passing a function or promise and be able to await its return-result, args must be serializable
/**
* create an in-memory worker by passing a function or promise and be able to await its return-result, args must be serializable
*
* @author Nabil Redmann
* @license MIT
*
* @see https://gist.github.com/BananaAcid/b8e3d609c5655301eccaeb44c9df9037
* @reference https://stackoverflow.com/a/19201292/1644202
*/
@BananaAcid
BananaAcid / Readme.md
Last active October 5, 2024 20:05
Nuxt module - simple base with auto-import

nuxt module base

A simple start with auto importing the common file types

setup

  1. follow the simple setup at nuxt.com > Modules
  2. copy the other files (at least magicImports.ts, optionally module.ts) from below to auto-import the common filetypes
  3. npm i fast-glob ... is required, as long as node:fs > glob is still experimental

free-space-json-api-server

Expose basic disk usage

{
    "free": 15024480256,
    "available": 15024480256,
    "freePercent": 3.01,
    "warnMin": false,
@BananaAcid
BananaAcid / app.json
Created August 2, 2024 15:48
dokku health check in nuxt
{
"scripts": {
"dokku": {
"predeploy": "cd app && npm install && npm run build"
}
},
"healthchecks": {
"web": [
{
"type": "startup",