Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 10:05
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; // ¯\\_(ツ)_/¯
@danielpunkass
danielpunkass / RSDimensionHuggingTextField.swift
Last active March 28, 2024 10:05
NSTextField subclasses that grow/shrink their width or height to fit text content
//
// RSDimensionHuggingTextField.swift
// RSUIKit
//
// Created by Daniel Jalkut on 6/13/18.
//
import Cocoa
// You probably want to use one of RSHeightHuggingTextField or RSWidthHuggingTextField, below
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@ipbastola
ipbastola / jq to filter by value.md
Last active March 28, 2024 10:04
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@Daan-Grashoff
Daan-Grashoff / google_search_maps_addon.js
Last active March 28, 2024 10:03
Bring back the google maps button when searching on google
// ==UserScript==
// @name Google maps addon
// @namespace http://tampermonkey.net/
// @version 2024-03-21
// @description Bring google maps button back
// @author You
// @match https://www.google.com/search*
// @include https://www.google.tld/search*
// @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png
// @grant none
@pR0Ps
pR0Ps / make-wg-client.sh
Last active March 28, 2024 10:01
Script to generate wireguard configs for clients to allow them to connect to the local wireguard server
#!/bin/bash
#######
# Setup
#######
### Enable IPv4/6 forwarding:
# # In /etc/sysctl.d/30-ipforward.conf :
# net.ipv4.ip_forward=1
# net.ipv6.conf.default.forwarding=1
# net.ipv6.conf.all.forwarding=1