Skip to content

Instantly share code, notes, and snippets.

View elliotwutingfeng's full-sized avatar
🐼

Wu Tingfeng elliotwutingfeng

🐼
View GitHub Profile
@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 / RubyOnArch.md
Created March 17, 2024 04:59 — forked from jhass/RubyOnArch.md
My Ruby setup on Archlinux

Ruby on Archlinux

I thought I would document my setup, since it's somewhat non-standard but working quite well for me.

What this does

  • Install major Ruby versions at their latest patch release
  • Allow to switch between them seamlessly
  • Use chruby
  • Encourage bundler usage
@elliotwutingfeng
elliotwutingfeng / phishing_bitwarden.txt
Last active March 14, 2024 03:11
List of phishing websites that attempt to impersonate the Bitwarden website. Visiting any of these websites is strongly discouraged. See https://bitwarden.com/help/bitwarden-addresses for an exhaustive list of official addresses used by Bitwarden.
3bitwarden.com
amsbitwarden.com
app-bitwarden.com
appbitwarden.com
bbitwarden.com
bitwarden360.com
bitwardenaccount.net
bitwarden.app
bitwarden-app.com
bitwardendamveien.com
@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 / setting-up-oh-my-zsh.md
Last active March 9, 2024 17:21
Setting up oh-my-zsh

oh-my-zsh

Install oh-my-zsh and some useful plugins

# Install oh-my-zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
@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 / fix-protonvpn-broken-connection.sh
Created February 13, 2024 06:34
Fix broken network connection after unclean termination of ProtonVPN connection
!#/usr/bin/sh
# List all active connections
nmcli connection show --active
# Delete any dangling connections that are related to protonvpn
# Usually it is `pvpn-ipv6leak-protection`
nmcli connection delete pvpn-ipv6leak-protection
@elliotwutingfeng
elliotwutingfeng / GPG_credentials_Manjaro.md
Created January 6, 2024 02:17
Retrieving GPG credentials from old Manjaro installation

Retrieving GPG credentials from old Manjaro installation

So it was time for a clean install on a larger SSD as my old system became completely unbootable (persistent initramfs uncompression error 😧).

However, I did not back up my GPG credentials 🤦.

I learned that retrieving them from the old system drive via chroot was technically possible but not a straightforward process.


@elliotwutingfeng
elliotwutingfeng / pick1or3.ipy
Created June 7, 2023 01:54
Fastest way to pick either 1 or 3 at random in IPython (IronPython). Inspired by Christopher's (twitter handle: @shrydar) suggestion featured in https://youtube.com/watch?v=VC-lbd8mTOs&t=1702s
from random import choice, random, randrange
# Fastest way to pick either 1 or 3 at random in IPython (IronPython).
# Inspired by Christopher's (twitter handle: @shrydar) suggestion
# featured in https://youtube.com/watch?v=VC-lbd8mTOs&t=1702s
# Tested on Python 3.11.3, Linux x64, AMD Ryzen 7 5800X
t = (1, 3)
@elliotwutingfeng
elliotwutingfeng / download_from_internet_archive.py
Created March 24, 2023 08:09
Simple script for multithreaded downloading from archive.org
"""
BSD Zero Clause License
Copyright (c) 2023 Wu Tingfeng
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY