Skip to content

Instantly share code, notes, and snippets.

View Delnegend's full-sized avatar
🌙

Delnegend Delnegend

🌙
View GitHub Profile
@Delnegend
Delnegend / markdown-preview.css
Created July 16, 2026 07:59
VSCode Markdown Preview stylesheet
body {
max-width: 900px;
margin: 0 auto;
padding: 0 20px;
}
@Delnegend
Delnegend / userscript.js
Created June 11, 2026 13:35
Always-enabled Kagi Quick Answer
// ==UserScript==
// @name Kagi Search URL Modifier
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Always-enabled Quick Answer
// @author You
// @match https://kagi.com/search*
// @grant none
// @run-at document-start
// ==/UserScript==
@Delnegend
Delnegend / calculate-tbw.sh
Last active July 15, 2024 09:33
Calculate the TBR and TBW of an SSD, requires `smartmontools` to be installed.
#!/bin/bash
# Change this to the SSD you want to check
drive="/dev/sda"
# Extract the sector size and LBA written from the output
sector_size=$(sudo smartctl -Ai $drive | grep 'Sector Size' | awk '{print $3}')
lba_written=$(sudo smartctl -Ai $drive | grep 'Total_LBAs_Written' | awk '{print $10}')
lba_read=$(sudo smartctl -Ai $drive | grep 'Total_LBAs_Read' | awk '{print $10}')
# Calculate TBW and print the result
tb_write=$(echo "scale=2; $sector_size * $lba_written / 1024^4" | bc -l)