Skip to content

Instantly share code, notes, and snippets.

@aburd
aburd / md-index.clj
Last active May 13, 2024 01:19
babashka script to make a markdown index for any markdown file
#!/usr/bin/env bb
(require '[clojure.string :as s])
(defn usage []
(println "md-index.clj [target-markdown-file]"))
(let [[p] *command-line-args*]
(when (or (nil? p) (not (s/ends-with? p ".md")))
(usage)
(System/exit 1))
@aburd
aburd / shell-script-model.sh
Created October 28, 2022 02:57 — forked from e-picas/shell-script-model.sh
A Bash script model with common options (verbose, force etc) & minimal functions (error, usage etc) to use and re-use to build your own shell scripts easily.
#!/usr/bin/env bash
#
# Bash script model
#
# A Bash script model with common options (verbose, force etc)
# & minimal functions (error, usage etc)
# to use and re-use to build your own shell scripts easily.
#
# To begin, run one of the followings:
#
@aburd
aburd / github_report.js
Created October 21, 2021 07:34
Get a report from a github issue
function daysUntilClosed() {
const hSel = "#partial-discussion-header relative-time"
const hSelEl = document.querySelector(hSel)
const d1 = new Date(hSelEl.title)
const hSel2 = "relative-time"
const hSelEls = document.querySelectorAll(hSel2)
const hSelEl2 = hSelEls[hSelEls.length - 1]
const d2 = new Date(hSelEl2.title)
import Puppeteer from 'puppeteer';
import { mapSeries } from 'bluebird';
import fs from 'fs';
const url = 'https://cdnjs.com/libraries';
async function getNewPages(browser: Puppeteer.Browser, page: Puppeteer.Page) {
console.log(`Getting libraries...`);
const urls = await page.$$eval('.title a', (els) =>
els.map((el) => (el as HTMLAnchorElement).href),
@aburd
aburd / js_object_map_get_set_comparison.js
Created October 12, 2019 16:22
Comparison of getting and setting speeds of Object vs. Map in Javascript (Map writes are very slow)
const testKeyName = 'foo'
const testAmount = 100000000
const obj = { [testKeyName]: 'bar' }
const map = new Map()
map.set(testKeyName, 'bar')
let objTestName = `Reading a property from obj ${testAmount} times`
console.time(objTestName)
for (let i = 0; i < testAmount; i++) {
obj[testKeyName]
@aburd
aburd / app.go
Last active July 5, 2018 04:46
A simple example of using Websockets in Go with the Gorilla lib
package main
import (
"fmt"
"net/http"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{}
@aburd
aburd / a.md
Last active November 12, 2016 10:24 — forked from mala/a.md
Investigation into the Live HTTP Headers Chrome Extension (Introduced by CoolBar.Pro - An investigation into what the extension is actually doing)