Skip to content

Instantly share code, notes, and snippets.

View andrei0x309's full-sized avatar

Andrei O. andrei0x309

View GitHub Profile
@andrei0x309
andrei0x309 / deno-mega-export.ts
Created March 10, 2024 02:02
Deno script to export share links from mega
import { walk } from "https://deno.land/std/fs/walk.ts";
import { join } from "https://deno.land/std/path/mod.ts";
const megaFiles = {}
async function crawlDirectory(relativePath: string): Promise<string[]> {
const filePaths: string[] = [];
const currentDir = Deno.cwd(); // Get the current working directory
const absolutePath = join(currentDir, relativePath);
@andrei0x309
andrei0x309 / addToIndexedDB.js
Created March 7, 2024 17:20
Add something to index DB, Browser don't allow direct modification of index DB from dev tools so you need to run a script like this.
const addToIndexedDB = async (dbName, version, storeName, keyPath, key, value) => {
try {
// Open a connection to the database
const dbRequest = indexedDB.open(dbName, version);
dbRequest.onupgradeneeded = (event) => {
const db = event.target.result;
// Create an object store if it doesn't exist
db.createObjectStore(storeName, { keyPath });
};
@andrei0x309
andrei0x309 / .scss
Created March 5, 2023 00:33
CSS For GitHub contibution table
.github-contributions {
--color-workflow-card-connector: var(--color-scale-gray-5);
--color-workflow-card-connector-bg: var(--color-scale-gray-5);
--color-workflow-card-connector-inactive: var(--color-border-default);
--color-workflow-card-connector-inactive-bg: var(--color-border-default);
--color-workflow-card-connector-highlight: var(--color-scale-blue-5);
--color-workflow-card-connector-highlight-bg: var(--color-scale-blue-5);
--color-workflow-card-bg: var(--color-scale-gray-7);
--color-workflow-card-inactive-bg: var(--color-canvas-inset);
--color-workflow-card-header-shadow: rgba(27, 31, 35, 0.04);
@andrei0x309
andrei0x309 / amp_comments.js
Last active March 26, 2021 23:24
Files for custom AMP WordPress Commenting System
// this file is loaded in worker-dom by amp-script and handles all comment functions
(async function ampComments() {
const addSiSpinner = function (element, prepend = false) {
const spinner = document.createElement('div');
spinner.classList.add('loadingspinner');
if (prepend) {
element.insertBefore(element, element.firstElementChild);
} else {
element.appendChild(spinner);
@andrei0x309
andrei0x309 / fail2ban-allstatus.sh
Last active December 6, 2016 11:15 — forked from kamermans/fail2ban-allstatus.sh
Show status of all fail2ban jails at once
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -r 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done