Skip to content

Instantly share code, notes, and snippets.

@smontanaro
smontanaro / dusort.sh
Created November 7, 2022 11:01
I got this du postprocessing script from "the net" in the dark ages (probably from Usenet in the 80s or 90s). I have no idea who the original author was. I've never modified it **at all**. It has always just worked.
#!/bin/sh
#
# sort a "du" listing by directory size
# usage: du | dusort
FILES=
TFORM=0
while test $# -ge 1; do
case $1 in
-t) TFORM=1; ;;
@donmccurdy
donmccurdy / delete_tweets.js
Last active November 11, 2024 21:42
Delete Tweets
// To delete tweets, navigate to your Twitter/X profile, open your browser's JavaScript console, and paste the script below.
async function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
async function deleteTweets() {
const tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1].textContent;
console.log('Remaining: ', tweetsRemaining);
window.scrollBy(0, 10000);
@jziggas
jziggas / nowhal.js
Last active November 11, 2024 21:37
JavaScript to delete all of your Reddit comments
// Go to https://www.reddit.com/user/<username>/ and paste into your console.
// Reddit throttles these actions, hence the 1s timer.
let interval = setInterval(() => {
let deleteButtons = $('a.togglebutton[data-event-action="delete"]');
if (deleteButtons.length === 0) {
clearInterval(interval);
if ($('.next-button > a')[0]) {
$('.next-button > a')[0].click();
alert('Restart script.');
}
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active November 11, 2024 21:31
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@jamesmacwhite
jamesmacwhite / ffmpeg_mkv_mp4_conversion.md
Last active November 11, 2024 21:28
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

Enable Dual Stack (IPv4 and IPv6) OpenFabric Routing

this gist is part of this series

This assumes you are running Proxmox 8.2 and that the line source /etc/network/interfaces.d/* is at the end of the interfaces file (this is automatically added to both new and upgraded installations of Proxmox 8.2).

This changes the previous file design thanks to @NRGNet for the suggestions to move thunderbolt settings to a file in /etc/network/interfaces.d it makes the system much more reliable in general, more maintainable esp for folks using IPv4 on the private cluster network (i still recommend the use of the IPv6 FC00 network you will see in these docs)

This will result in an IPv4 and IPv6 routable mesh network that can survive any one node failure or any one cable failure. Alls the steps in this section must be performed on each node

@scyto
scyto / proxmox-tb-net.md
Last active November 11, 2024 21:27
Thunderbolt Networking Setup

Thunderbolt Networking

this gist is part of this series

NOTE FOR THIS TO BE RELIABLE ON NODE RESTARTS YOU WILL NEED PROXMOX KERNEL 6.2.16-14-pve OR HIGER

This fixes issues i bugged with the thunderbolt / thunderbolt-net maintainers (i will take everyones thanks now, lol)

Install LLDP - this is great to see what nodes can see which.

  • install lldpctl with apt install lldpd
@neomantra
neomantra / compressed_reader_writer.go
Created May 28, 2024 20:14
Compression wrappers for io.Reader and io.Writer
// Copyright (c) 2024 Neomantra BV
//
// Opinionated Reader/Writer wrappers
package nmio
import (
"compress/gzip"
"io"
"os"
@AfroThundr3007730
AfroThundr3007730 / Rocky_8_STIG_notes.md
Last active November 11, 2024 21:20
Notes on getting Rocky 9 and Ubuntu 24.04 compliant with DISA STIGs

Rocky 8 STIG notes

Red Hat Enterprise Linux 8 Security Technical Implementation Guide :: Version 1, Release: 14 Benchmark Date: 24 Apr 2024

Updated on 2024-07-02

Utilities

All fix and check commands must be run as root.