Skip to content

Instantly share code, notes, and snippets.

View hdavid0510's full-sized avatar
🐒
I may be slow to respond.

David.Hong hdavid0510

🐒
I may be slow to respond.
View GitHub Profile
@hdavid0510
hdavid0510 / ssd_tbw.sh
Created May 25, 2025 08:14
Get TBW of connected SSDs through smartctl
#!/bin/bash
# ANSI colors
TEXT_CYAN='\e[96m'
TEXT_YELLOW='\e[93m'
TEXT_DEFAULT='\e[0m'
# Common formatter for byte-related outputs
function format_bytes_written_and_rate() {
local BYTES_WRITTEN=$1
@hdavid0510
hdavid0510 / wsl2-portforward.ps1
Last active September 17, 2023 06:06 — forked from hoonoh/wsl2-portforward.ps1
wsl2 port forwarding script
#DEBUG/ To check script running time
$start = Get-date
Write-Host "Obtaining WSL2 IP address" -foreground cyan;
$remoteAddr = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteAddr -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteAddr = $matches[0];
@hdavid0510
hdavid0510 / markdown-text-101.md
Created September 5, 2023 13:51 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

clc, clear, close('all')
%% PLOT
x = -4:0.1:8;
plot(x, ku2021_mech457_hw1_q8_f(x))
xlabel('x'); ylabel('y');
title('f(x) = -0.6*x^2 + 2.4*x + 5.5');
hold on, plot([x(1), x(end)], [0,0], 'k')
clear x
@charset "UTF-8";
/*
* κΈ€μž 크기λ₯Ό 12px(μ΅œμ†Œ)둜 μ„€μ •ν•˜μ‹œλ©΄ μ‹€μ œ μΈκ²Œμž„ 크기가 λ©λ‹ˆλ‹€.
* νŠΈμœ•(TWIP) κΈ°λ³Έ ffxiv ν…Œλ§ˆμ—μ„œ λ””ν…ŒμΌμ„ μ•½κ°„ μˆ˜μ •ν•˜μ˜€μŠ΅λ‹ˆλ‹€.
*/
:root{
--twip-font-size: $font_sizepx
}
a=0
b=0
c=0
d=0
e=0
f=0
t=0
@hdavid0510
hdavid0510 / RPi_I2C_driver.py
Created July 8, 2020 19:21 — forked from DenisFromHR/RPi_I2C_driver.py
RaspberryPi I2C LCD Python stuff
# -*- coding: utf-8 -*-
"""
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic
Made available under GNU GENERAL PUBLIC LICENSE
# Modified Python I2C library for Raspberry Pi
# as found on http://www.recantha.co.uk/blog/?p=4849
# Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library
# added bits and pieces from various sources
# By DenisFromHR (Denis Pleic)
@hdavid0510
hdavid0510 / sources.list
Created June 10, 2020 08:21
Ubuntu 18.04 default sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
@hdavid0510
hdavid0510 / WindowsTerminal_ContextMenu.reg
Last active June 11, 2020 17:54
Windows Terminal contextmenu shortcut. 1) Windows Terminal from Microsoft Store should be installed 2) PsExec64 should be accessible by adding PATH or modding path to PsExec64.exe on reg file 3) Change [[USERNAME]] to actual username before run.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\WindowsTerminal]
@="Open Windows Terminal here"
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\WindowsTerminal\command]
@="C:\\Users\\ [[USERNAME]] \\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\WindowsTerminalAdmin]
@hdavid0510
hdavid0510 / omok.c
Created April 26, 2017 05:46
였λͺ©κ²Œμž„ μ†ŒμŠ€μž…λ‹ˆλ‹€. 배열을 톡해 였λͺ©νŒμ„ κ΅¬ν˜„ν•˜μ˜€κ³ , 였λͺ©νŒ λ°°μ—΄μ˜ μ£Όμ†Ÿκ°’κ³Ό μ»€μ„œ λ°°μ—΄(X, Y)의 두 μ’Œν‘―κ°’μ„ λŒ€μ‘μ‹œμΌœμ„œ μ»€μ„œλ₯Ό κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€. 였λͺ©μΉΈ μ‚¬μ΄μ‚¬μ΄μ˜ 넓이가 넓은 였λͺ©νŒκ³Ό 쒁은 였λͺ©νŒμ΄ 있으며 μ΄λŠ” μ£Όμ„μ²˜λ¦¬λ₯Ό 톡해 μ›ν•˜λŠ” 였λͺ©νŒ 그리기 ν•¨μˆ˜λ₯Ό κ³ λ¦„μœΌλ‘œμ¨ 취사선택할 수 μžˆμŠ΅λ‹ˆλ‹€. 윑λͺ© μ΄μƒμ˜ νŒμ •μ€ 승리둜 μΈμ •λ˜μ§€ μ•ŠμœΌλ©°, 3-3κΈˆμ§€λŠ” 아직 κ΅¬ν˜„ν•˜μ§€ λͺ»ν–ˆμŠ΅λ‹ˆλ‹€.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define UP 72
#define LEFT 75
#define DOWN 80
#define RIGHT 77
#define SPACE 32
#define ENTER 13