Skip to content

Instantly share code, notes, and snippets.

@startergo
startergo / overlay.md
Last active September 11, 2023 16:53
OpenWRT create overlay backup and restore
  • SSH to your router. Create backup:
tar -cvzf /tmp/overlay.tar.gz /overlay
  • Copy the backup to a safe location:
scp -O [email protected]:/tmp/overlay.tar.gz ~/Downloads
  • After fresh install restore the backup:
@startergo
startergo / large_files.md
Created September 9, 2023 20:25
How to find large files on Mac
  • To find files larger than 100 MB with Terminal in Volume named Mojave type:
sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }’ > large_files.txt
  • To remove files examine the file large_files.txt , and type:
rm -rF 
  • And copy-paste any path from the results: terminal-search-for-large-files
@startergo
startergo / svn-git.md
Created September 2, 2023 19:20
Migrate Archive Google Code SVN to Git

Migrate Archive Google Code SVN to Git

Requirements

  • git
  • git-svn

Setup¹

sudo apt-get install git
sudo add-apt-repository ppa:git-core/ppa
@startergo
startergo / sed_find_replace.md
Last active September 1, 2023 21:21
Sed find and replace in macOS
  • Example 1:
find . -name "*.py" -exec sed -i '' -e 's|#!/usr/bin/python|/#!usr/bin/env python|g' {} \;
  • Example 2:
find . -type f -exec sed -i '' -e 's|#!/usr/bin/python|/#!usr/bin/env python|g' {} \;

If you get RE error: illegal byte sequence on Mac OS X add these lines:

@startergo
startergo / homebrew_dep.md
Created September 1, 2023 19:22
List Homebrew dependencies
brew deps --tree --installed
@startergo
startergo / makeUniversalDisc.command
Last active August 27, 2023 20:14
Create Universal Snow Leopard DVD from Restore DVD
#!/bin/bash
clear
destination=~/Desktop/Mac\ OS\ X\ Install\ DVD
#make destination folder
[ ! -d "$destination" ] && mkdir "$destination"
#make sure disc is in drive
while [ ! -d /Volumes/Mac\ OS\ X\ Install\ DVD ] ; do
@startergo
startergo / trustroot.md
Last active November 16, 2023 17:35
Update the root certificates on an older version of Mac OS
  • On older macOS's you may have difficulty reaching various secure web sites. They might give you a certificate expired error. They will work in Firefox, but not in Safari or Chrome. They also work on newer versions of macOS (e.g. Catalina, Big Sur). This seems to be because Safari and Chrome use the OS root certificate store and Firefox uses its own, and El Capitan and older macOS's are not being updated.
  • To update the root certificates on old macOS's follow this:
  1. On that Mac with up to date certificates, launch Keychain Access, select "System Roots", select all certificates, select File->Export, and export them as rootcerts.pem file. This file will contain all the certificates concatenated.
  2. Copy the rootcerts.pem file to your obsolete macOS.
  3. Make the trustroot shell script below:
#!/bin/bash
DIR=${TMPDIR}/trustroot.$$
mkdir -p ${DIR}
@startergo
startergo / progress.md
Created July 24, 2023 22:01
Track dd progress in terminal
  • Progress can track progress of data transfer processes. Install with:
brew install progress
  • Then launch dd, get its PID with:
ps aux | grep "dd"
  • Or with pidof
@startergo
startergo / add_directory_to_path.md
Created July 24, 2023 19:35
Add directory to path
  • This will make sure that /usr/local/bin is part of PATH for all shells started/Terminal tabs created after the line has been executed.
sudo sh -c 'grep -q "/usr/local/bin" /etc/paths || echo "/usr/local/bin" >> /etc/paths'
@startergo
startergo / wget_curl_gdown.md
Last active July 23, 2023 15:40
Download a file with wget, curl or gdown to bypass quarantine flag in macOS
  • Download a file from gDrive using gdown by using the file id:
gdown <file_id> --output "some.dmg"
  • Download a file using wget from Dropbox by changing dl=0 to dl=1 at the end of the shared link:
wget -O "file_name.dmg" "https://www.dropbox.com/s/<random_numbers>.dmg?dl=1"
  • Download a file using curl from Dropbox by changing dl=0 to dl=1 at the end of the shared link: