Skip to content

Instantly share code, notes, and snippets.

View elliotwutingfeng's full-sized avatar
🐼

Wu Tingfeng elliotwutingfeng

🐼
View GitHub Profile
@elliotwutingfeng
elliotwutingfeng / vscode_wsl_ubuntu_extensions.md
Created May 30, 2025 09:41
VSCode: How to install local extensions in Ubuntu WSL (Windows Subsystem for Linux)

Go to Extensions tab (Ctrl + Shift + X) and click the little cloud icon on the right side of "WSL: UBUNTU - INSTALLED).

@elliotwutingfeng
elliotwutingfeng / zsh_history_utf8_wsl2.zsh
Created April 16, 2025 09:30
Ensuring .zsh_history is in utf-8 format on Windows Subsystem for Linux 2 (Ubuntu)
export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@elliotwutingfeng
elliotwutingfeng / remove_duplicate_entries_from_zsh_history_with_timestamp.py
Created April 14, 2025 02:34
Remove duplicate entries from .zsh_history with timestamp.
"""
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@elliotwutingfeng
elliotwutingfeng / password_entropy.py
Last active April 10, 2025 01:55
Estimate password entropy.
"""Estimate password entropy.
Entropy (bits) | Estimated Strength
---------------|-------------------
0 to 35 | Very weak
36 to 59 | Weak
60 to 119 | Strong
120+ | Very strong
WARNING: High entropy is of little use if the password has been leaked before in data breaches.
@elliotwutingfeng
elliotwutingfeng / ubuntu-24.04-2014-macbook-air.md
Last active March 27, 2025 14:07
Installing Ubuntu 24.04 on a 2014 Macbook Air

Installing Ubuntu 24.04 on a 2014 Macbook Air

  • Recommended: Use LVM + Encryption.
  • Expect slow installation speeds (the ports are USB 3.0 but are stuck at 2.0 speeds during installation)
  • Do not bother with installing proprietary components during OS installation; it is too slow. Do it post-installation.

Wi-Fi

  • Wi-Fi will not work out of the box. You will need a USB Wi-Fi dongle to download Wi-Fi drivers from the Internet.
  • After installing the OS, plug in your Wi-Fi dongle and run the following commands to update the system, install Wi-Fi drivers, and upgrade snap packages.
@elliotwutingfeng
elliotwutingfeng / useful_web_browser_content_filtering_addons.md
Last active January 16, 2025 01:25
Useful Web Browser Content Filtering Addons

Useful Web Browser Content Filtering Addons

These should all be available on Firefox/Chrome/Edge.

  • ClearURLs
    • Remove tracking elements from URLs.
  • Decentraleyes
    • Protects you against tracking through "free", centralized, content delivery.
  • Disconnect
  • Lets you visualize and block the invisible websites that track you.
@elliotwutingfeng
elliotwutingfeng / macos_setup_guide.md
Last active September 23, 2024 20:12
macOS Setup Guide

macOS Setup Guide

Updated as of 24 September 2024.

Here are some non-exhaustive practical tips from an occasional macOS user.

Buying a Mac

  • Do not buy an Intel Mac unless you need to run applications that just won't work on Apple Silicon.
  • Based on past trends, it is reasonable to expect new Apple Silicon Macs to receive about 7 years of new macOS releases.
@elliotwutingfeng
elliotwutingfeng / genpass.sh
Last active August 28, 2024 20:33
One-liner to generate alphanumeric password in Ruby (1.8.2+)
ruby -e "require 'openssl'; c = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; puts (0...24).map { i = OpenSSL::Random.random_bytes(1).unpack('C').first % c.length; c[i..i] }.join"
# Or alternatively to avoid homoglyphs (https://en.wikipedia.org/wiki/Homoglyph)
# ruby -e "require 'openssl'; c = '3479AEFHJLNQRTYabdefghijnqrty'; puts (0...24).map { i = OpenSSL::Random.random_bytes(1).unpack('C').first % c.length; c[i..i] }.join"
@elliotwutingfeng
elliotwutingfeng / seconds_diff.py
Created August 5, 2024 08:23
time difference in seconds
def seconds_diff(time1: str, time2: str) -> int:
def to_seconds(time_str: str) -> int:
minutes, seconds = map(int, time_str.split(':', 1))
return minutes * 60 + seconds
return abs(to_seconds(time1) - to_seconds(time2))
@elliotwutingfeng
elliotwutingfeng / disable_google_assistant_pixel.md
Created June 14, 2024 10:04
Disable Google Assistant on Google Pixel devices

Disable Google Assistant on Google Pixel devices

Stop Google Assistant from popping up whenever you plug in your earphones by disabling the "Google" app on your Google Pixel device (phone or tablet).