Skip to content

Instantly share code, notes, and snippets.

@immannino
immannino / dom3d.js
Created August 14, 2024 22:31 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
// a small exmaple cli application for sending emails
//
// Expects a .env with the following configuration:
//
// EMAIL_ADDRESS=<from address>
// EMAIL_PASSWORD=<app password>
// EMAIL_HOST=smtp.gmail.com
// EMAIL_PORT=587
// RECIPIENT=<optional>
// SITEMAP=<optional>
// a small exmaple cli application for sending emails
//
// Expects a .env with the following configuration:
//
// EMAIL_ADDRESS=<from address>
// EMAIL_PASSWORD=<app password>
// EMAIL_HOST=smtp.gmail.com
// EMAIL_PORT=587
// RECIPIENT=<optional>
//
@immannino
immannino / migrate.py
Created October 20, 2022 18:30 — forked from bennylope/migrate.py
PostgreSQL migration script, Heroku -> Crunchy
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
import time
# Required so we don't generate tons of logs during restore
disable_logging_sql = "ALTER USER postgres RESET pgaudit.log;"
@immannino
immannino / find-where-alias-defined.sh
Created July 20, 2022 18:48
Small script to find where alias is defined in zsh
zsh -ixc : 2>&1 | grep ...
package main
import (
"encoding/json"
"fmt"
"html-to-pdf/model"
"html-to-pdf/pdf"
"html-to-pdf/template"
"log"
"net/http"
package main
import (
"encoding/json"
"fmt"
"html-to-pdf/model"
"html-to-pdf/pdf"
"html-to-pdf/template"
"io/ioutil"
"log"
package template
import (
"bytes"
"html/template"
)
type HTMLTemplateInterface interface {
Compile(interface{}, string) (bytes.Buffer, error)
}
{{define "PDF"}}
<!DOCTYPE html>
<html lang="en">
<body>
<div class="page cover">
<div class="wrapper">
<div class="banner">
<h1>{{ .CompanyName }} Official Document</h1>
<p>Preseted to {{ .FullName }}</p>
</div>
package model
import (
"fmt"
"strings"
"time"
)
type PDF struct {
FirstName string `json:"FirstName" example:"Tony"`