Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
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; // ¯\\_(ツ)_/¯
@vinayakg
vinayakg / download-images-transform.sh
Last active June 9, 2023 06:18
download-images-transform
#!/bin/bash
# Function to process each file
process_file() {
local file="$1"
local relative_full_path="$2" # Full path of the file
local remote_file_path="http://3.84.160.28/images/$relative_full_path"
# fill an image if its smaller on one of the dimension using center crop
local url="https://mlznzveokpms.i.optimole.com/q:85/rs:fit/$remote_file_path"
@vinayakg
vinayakg / lists.txt
Last active March 27, 2022 06:59 — forked from ScottHelme/lists.txt
My Pi-hole blocklist list.
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
http://sysctl.org/cameleon/hosts
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/Easyprivacy.txt
https://v.firebog.net/hosts/Prigent-Ads.txt
https://zerodot1.gitlab.io/CoinBlockerLists/hosts
https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
@vinayakg
vinayakg / linux-commands.sh
Last active March 24, 2024 14:24
Handy Linux commands that have been using for years
Find files size excluding folders in the current directory
`find . -name "*.*" -type f -depth 1 -exec du -ch {} +`
Batch file to delete files older than N days
`forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"`
Running a batch program in one line
@vinayakg
vinayakg / find-address-live-traffic.sh
Last active March 24, 2024 14:23
find ip address and their location from live traffic on machine
lsof -iTCP -P | grep Spark | awk '{print $9}' | cut -d '>' -f2 | cut -d ':' -f1 | uniq | xargs -I% curl ipinfo.io/%/org
@vinayakg
vinayakg / brew-cask-m1.txt
Last active July 14, 2024 12:06
Brew cask packages
android-ndk
android-platform-tools
android-sdk
android-studio
appcleaner
arduino
cloudflare-warp
coteditor
dbeaver-community
docker
@vinayakg
vinayakg / install-m1.rb
Last active March 2, 2022 12:15 — forked from skyl/install.rb
Homebrew without sudo
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
# SET YOUR_HOME TO THE ABSOLUTE PATH OF YOUR HOME DIRECTORY
# chmod +x install.rb
# ./install.rb
if ARGV.length < 1
puts "Too few arguments, please include the folder name to install your packages there"
exit
end
@vinayakg
vinayakg / cloudSettings
Last active March 2, 2022 12:14
Visual Studio Code Settings Sync
{"lastUpload":"2021-12-12T18:16:37.310Z","extensionVersion":"v3.4.3"}
@subfuzion
subfuzion / curl.md
Last active July 25, 2024 08:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@paulirish
paulirish / what-forces-layout.md
Last active July 25, 2024 07:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent