Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 23:32
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; // ¯\\_(ツ)_/¯
@dmitriyvolk
dmitriyvolk / animals.Animal.java
Created March 26, 2024 23:16
Generics: RedRover 2024 Spring Lecture 16
package animals;
public class Animal {
private final String name;
private final double weight;
private final double canLiftWeight;
public Animal(String name, double weight, double canLiftWeight) {
this.name = name;
this.weight = weight;
@ANRCorleone
ANRCorleone / readme.txt
Last active March 28, 2024 23:31 — forked from CraigCottingham/readme.txt
Ubuntu 22.04 + Hyper V + Enhanced Session mode + XRDP PulseAudio
Credits
# https://c-nergy.be/blog/?p=13655
# https://askubuntu.com/questions/844245/how-to-compile-latest-pulseaudio-with-webrtc-in-ubuntu-16-04
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
# https://unix.stackexchange.com/questions/65167/enable-udev-and-speex-support-for-pulseaudio
# https://rudd-o.com/linux-and-free-software/how-to-make-pulseaudio-run-once-at-boot-for-all-your-users
# https://gist.github.com/rkttu/35ecab5604c9ddc356b0af4644d5a226
# Installation and Enhanced session
# follow steps on the post below, I installed Ubuntu 22.04 on a Windows 11 machine
@drewkerr
drewkerr / get-focus-mode.js
Last active March 28, 2024 23:28
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@tayvano
tayvano / gist:6e2d456a9897f55025e25035478a3a50
Created February 19, 2017 05:29
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@iosecure
iosecure / iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment.md
Last active March 28, 2024 23:23
iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

This post by a security researcher who prefers to remain anonymous will elucidate concerns about certain problematic decisions Apple has made and caution about future decisions made in the name of “security” while potentially hiding questionable motives. The content of this article represents only the opinion of the researcher. The researcher apologises if any content is seen to be inaccurate, and is open to comments or questions through PGP-encrypted mail.



TL;DR

@michaeljclark
michaeljclark / misaligned_atomics.c
Last active March 28, 2024 23:23
Demonstrates torn loads for misaligned atomics
#include <stdio.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <limits.h>
#include <pthread.h>
/*
* Intel® 64 and IA-32 Architectures Software Developers Manual
*
* Volume 3A - 8.1.1 Guaranteed Atomic Operations
@RRethy
RRethy / gist:ad8a9a3b1112a48226ec3336fa981224
Last active March 28, 2024 23:22
Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Neovim and Vim both come bundled with a standard plugin called Netrw. Netrw acts a file explorer (similar to NERDTree), but more importantly has the ability to work with scp (as well as sftp, rcp, ftp, and lots of others :h netrw-nread) to let you edit files and browse directories that are hosted on a remote machine, inside of your local Vim instance.

This is useful since you are able to use your Vim setup and plugins without copying over your dotfiles to the remote machine. As well, since the file is copied to your local machine, there will be no delay when typing.

Setup

This is optional for Vim, but required for Neovim (check this Neovim issue explaining why).

@diego3g
diego3g / settings.json
Last active March 28, 2024 23:21
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@pythoninthegrass
pythoninthegrass / .env.example
Created March 28, 2024 23:14
Public facing version of an internal Infisical export script
BASE_URL=
ID=
SERVICE_TOKEN=
OUT_DIR=