Skip to content

Instantly share code, notes, and snippets.

View phildenhoff's full-sized avatar

Phil Denhoff phildenhoff

View GitHub Profile
@parties
parties / renameReactJsToJsx.sh
Last active July 12, 2024 20:21
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@lucasgonze
lucasgonze / gist:c5d935823ef17f5ffa3f
Last active December 21, 2023 02:17
DIY URL Shortener

Do This

  1. Create dedicated domain on an Apache server that supports .htaccess
  2. ssh to root directory there
  3. Use random.org to create 200 random strings. (Five characters long, with digits, uppercase letters and lowercase letters).
  4. Save to short-strings.txt
  5. echo "RewriteRules On" > .htaccess
  6. cat short-strings.txt | awk '{print "RewriteRule ^"$1"$ TO [R,L]"}' >> .htaccess
  7. rm short-strings.txt
  8. When you want to shorten a URL, edit .htaccess. Replace any TO with the long URL.
@afair
afair / tmux.cheat
Last active June 3, 2024 23:26
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &