mac and mac os
extract rpm file to current directory
brew install rpm2cpio
rpm2cpio file.rpm | cpio -i --make-directoriesuse vscode code command on terminal without admin rights
add this to your .zshrc
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}set a mac mini to turn on after a power failure without macos
if using linux on a mac mini hardware, search for a LPC controller
sudo lspci | grep LPCset the auto start flag on this controller
sudo setpci -s 00:1f.0 0xa4.b=0if needed, search for the right flag on this datasheet.
resizing an sparseimage
first, unmount the image if in use.
to increase the image size to 50Gb:
hdiutil resize -size 50g filename.sparseimageto shrink the image size:
hdiutil compact filename.sparseimagereference: Sparse image Wikipedia article
find a file encoding
$ file -I original.csv
original.csv: text/plain; charset=iso-8859-1convert file to another encoding
iconv -f iso-8859-1 -t utf-8 < original.csv > copy.csvremove windows line breaks
install homebrew. follow the instructions on https://brew.sh
after that, use homebrew to install dos2unix
brew install dos2unixand use it
dos2unix original.csvrebuild the spotlight index
sudo mdutil -E /what the -E option does?
-E This flag will cause each local
store for the volumes indicated to
be erased. The stores will be
rebuilt if appropriate.remove duplicated entries in the open with list
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain userreference: Rebuild LaunchServices to Fix Duplicate Entries in OS X’s ‘Open With’ Menu
add a directory to the $PATH
on mac os there's a directory called /etc/paths.d. inside that, the path_helper utility add the reference to all directories used on $PATH.
to add any directory to /etc/paths.d:
sudo -s 'echo "/my/new/path" > /etc/paths.d/my'pay attention: the files inside /etc/pths.d can't have empty line endings.
reference: Mac OS X: Set / Change $PATH Variable
run more than one instance of an app
open -n -a "app name"