Skip to content

Instantly share code, notes, and snippets.

@snoj
snoj / DOM3D.js
Created March 27, 2024 17:39 — 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; // ¯\\_(ツ)_/¯
@snoj
snoj / encoding-helpers.ps1
Created September 30, 2016 16:35 — forked from jpoehls/encoding-helpers.ps1
Convert-FileEncoding and Get-FileEncoding
<#
.SYNOPSIS
Converts files to the given encoding.
Matches the include pattern recursively under the given path.
.EXAMPLE
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8
#>
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') {
$count = 0
@snoj
snoj / cleanboot
Created July 15, 2016 02:12 — forked from anonymous/cleanboot
Cleans the /boot folder of all images that is not what is running.
#!/bin/bash
aptitude search linux-image* -F "%c %p" | grep -E "^i.*" | grep -v -E "\slinux-image-generic\s" | grep -v -E `(uname -r | awk '{split($0, a, "-[a-z]"); print a[1];'})` | awk '{ print $2; }' | xargs aptitude remove -y;
update-grub;
@snoj
snoj / gist:3231686
Created August 1, 2012 23:59
Charter 6rd Script
#!/bin/bash
##original https://gist.github.com/1016433
#Had issues with this and many scripts as they all assumed that my primary router had ipv6 support and that I wasn't hiding behind something.
#This script sets your Linux (I use Ubuntu) box to function as a 6RD routing device.
#I've left out radvd as I use HE TunnelBroker for my network's addressing.
#Get Charter's 6rd host
HOST6RD=$(nslookup 6rd.charter.com | grep "Address"| awk '{ print $2 }'| tail --lines=1);