Skip to content

Instantly share code, notes, and snippets.

View marshyon's full-sized avatar

jon brookes marshyon

View GitHub Profile
@marshyon
marshyon / fuzzy_string_search.dart
Last active October 2, 2023 17:21
fuzzy string search of list of objects in dart using fuzzywuzzy
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
class Book {
final String title;
final String author;
final String genre;
final String summary;
Book(this.title, this.author, this.genre, this.summary);
}
@marshyon
marshyon / gitea-backup.sh
Created September 5, 2023 09:41 — forked from bst27/gitea-backup.sh
A Gitea backup script for Docker: It creates a .zip backup of Gitea running inside Docker and moves the backup file to the current working directory.
#!/bin/bash
# This script creates a .zip backup of gitea running inside docker and copies the backup file to the current working directory
echo "Creating gitea backup inside docker containter ..."
docker exec -u git -it -w /tmp $(docker ps -qf "name=gitea_server_1") bash -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini --file /tmp/gitea-dump.zip'
echo "Copying backup file from the container to the host machine ..."
docker cp $(docker ps -qf "name=gitea_server_1"):/tmp/gitea-dump.zip /tmp
@marshyon
marshyon / animejs-staggered-grid-effect.markdown
Created February 20, 2023 13:18
AnimeJS Staggered Grid Effect
@marshyon
marshyon / hacked-text-effect.markdown
Created February 20, 2023 12:42
Hacked Text Effect
@marshyon
marshyon / app.js
Created February 4, 2023 20:35
parsing markdown with html tables that have 'spanning rows' - otherwise not possible with plain markdown
const tableMarkdown = `
# Table
<table>
<tr>
<td>One</td>
<td>Two</td>
</tr>
<tr>
@marshyon
marshyon / app.js
Created February 4, 2023 16:47
simple nodejs app that parses markdown, extracts the front-matter for later use then extracts, parses and outputs html for the main body, itself containing 'escaped' html in code blocks
mdHTMLMix = `---
id: q.yada yada.e
title: Network Designs Quiz
desc: ''
updated: 1668088687103
created: 1667513672394
---
# Network Designs Quiz
<figure>
@marshyon
marshyon / app.js
Last active February 4, 2023 16:32
simple node js app that can read in html, parse it and substitute known elements with new ones using cheero / JQuery of the days of yore
const cheerio = require('cheerio')
const htmlContent = `
<div class="rounded-sm shadow-xl p-10 shadow-md text-center bg-slate-100 text-primary box">
<div class="text-3xl pb-7 font-serif">CONTACT</div>
<div class="pb-5 prose-xl">How to contact me</div>
<article class="md:prose-lg prose-sm break-words">
<p>We&#x27;ll arrange a short telephone conversation and then work out the best options for you.</p>
<p>Please email me</p>
<p><a href="mailto:anne.brookes@canalsidecoach.app">anne.brookes@canalsidecoach.app</a></p>
<p>I am a qualified NLP Coach and Practitioner. I use strategies that bring about real change - techniques called &quot;Creating your future&quot; or Time Line TherapyTM.</p>
@marshyon
marshyon / main.go
Created January 24, 2023 21:14
Golang run and wait for many go routines using channels and returning a struct of result data for each process
package main
import (
"fmt"
"log"
"math/rand"
"time"
)
type SystemCommandResult struct {
@marshyon
marshyon / react-native-tab-stack-nav.js
Created January 13, 2023 13:11
react native tab and stack ( combined ) navigation
import 'react-native-gesture-handler';
import { StyleSheet, Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator()
function StackNavHome() {
@marshyon
marshyon / Delete All Emails from a ProtonMail Account.md
Last active November 1, 2022 14:09
delete all mails in Protonmail

Why ?

If you intend to stop using Protonmail, non of this is required however if you just want to clear down unwanted emails and claim back storage quota this may be of use.

According to ProtonMail support in normal operation you need to move emails to the delete folder then go into the delete folder and delete all to get rid of them.

This way youre 'all mail' folder wont just fill up eternally, increasing storage and thus require to buy more storage

Also if youve got a paid plan and wish to delete an associated domain name, you can't do this untill all emails that are addressed to that domain have first been deleted.