Skip to content

Instantly share code, notes, and snippets.

@veysiertekin
Last active January 17, 2024 01:10
Show Gist options
  • Select an option

  • Save veysiertekin/01fa8439245014e72ef5090032f7eb53 to your computer and use it in GitHub Desktop.

Select an option

Save veysiertekin/01fa8439245014e72ef5090032f7eb53 to your computer and use it in GitHub Desktop.
Mac OS X macos
eval "$(jenv init -)"
export ALICLOUD_ACCESS_KEY="<api_key>" && export ALICLOUD_SECRET_KEY="<secret_key>"
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -F /usr/local/bin/aliyun aliyun
export PATH="/usr/local/sbin:$PATH"
export PATH="$HOME/.gem/ruby/2.3.0/bin:$PATH"
# added by travis gem
[ -f /Users/veysi.ertekin/.travis/travis.sh ] && source /Users/veysi.ertekin/.travis/travis.sh
# show-hidden-files
defaults write com.apple.finder AppleShowAllFiles YES
#change default text editor for gui
defaults write com.apple.LaunchServices LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

1- Install ntfs-3g

brew cask install osxfuse
brew install ntfs-3g

2- Restart and enter to recovery mode by pressing Command+R

3- Disable System Integrity Protection

csrutil disable

2- Restart

3- Replace default mount-ntfs driver with ntfs-3g

sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs

4- Restart and enter to recovery mode by pressing Command+R

5- Enable System Integrity Protection

csrutil enable

6- Restart

7- At first ntfs device macOS will ask for permission in System Preferences for the osxfuse. Open system preferences and allow it. [this is necessary for new os releases]

8- Done!

# Open sudo file with root
sudo vi /etc/pam.d/sudo
# Add following line to top
auth sufficient pam_tid.so
# Quit `vi` with overriding current `readonly` status
:wq!
# to enable web interface
cupsctl WebInterface=yes
# web interface
http://localhost:631/printers/

How to fix app “is damaged and can’t be opened. You should move it to the Trash” error

$ xattr -cr /path/to/application.app
sudo chown -R $(whoami) $(brew --prefix)/*
# or
sudo chown -R <username>:admin /usr/local/*
# reset homebrew:
brew update-reset
# Fix mac os display when could not open Displays settings.
cd ~/Downloads && curl -LO http://dl.dropbox.com/u/6347985/Modbookish/Downloads/MacFlip/fb-rotateNEW2.zip && unzip fb-rotateNEW2.zip && fb-rotateNEW2/fb-rotate -d0 -r0 && echo done
# source http://ss64.com/osx/chflags.html
# make file immutable ( root can not delete too :) )
sudo chflags schg <File>
# Remove immutable flag
sudo chflags noschg <File>
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
brew install zsh-syntax-highlighting
brew install zsh-autosuggestions
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
echo "source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
# jenv
brew install jenv
echo 'eval "$(jenv init -)"' >> ~/.zshrc
exec $SHELL -l # restart to load jenv properties
jenv enable-plugin maven
jenv enable-plugin sbt
jenv enable-plugin gradle
jenv add /Library/Java/JavaVirtualMachines/jdk*/Contents/Home/
jenv global <java_version>
# brew install activemq
brew install asciinema
brew install composer
brew install consul
brew install elixir
brew install exercism
brew install maven
brew install memcached
brew install mongodb
brew install mysql
brew install youtube-dl
brew install watch
brew install tmux
brew install telnet
brew install jq
brew cask install android-sdk
brew cask install google-cloud-sdk
brew cask install minikube
brew cask install docker
# java 7
# http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
# java 8
brew cask install caskroom/versions/java8
brew cask install copyq
brew cask install gimp
brew cask install virtualbox
brew cask install keepassxc
brew cask install calibre
brew cask install spotify
brew cask install evernote
brew cask install vlc
brew cask install textmate
brew cask install opera
brew cask install google-chrome
brew cask install firefox
brew cask install skype
brew cask install whatsapp
brew cask install keka
brew cask install keyboard-cleaner
# brew cask install vip-access
brew cask install gas-mask
brew cask install macdown
brew cask install robo-3t
# brew cask install soapui
brew cask install postman
# brew cask install sequel-pro
brew cask install dbeaver-community
brew cask install intellij-idea
brew cask install cyberduck
brew cask install sublime-text
# Install php requirements
pecl install xdebug
brew install phpunit
brew install [email protected]
brew install brew-php-switcher
brew install php56
# Ruby gems
gem install travis --user-install
#
# macOs specific tools
#
# scriptable image processing system
sips
# find usb part location
diskutil list
mkdir ~/Desktop/my_usb
# mount with write permission
sudo mount -w -t exfat /dev/disk3s1 ~/Desktop/my_usb
# or
sudo mount -w -t msdos /dev/disk3s1 ~/Desktop/my_usb
# mount with read-only permission
sudo mount -r -t exfat /dev/disk3s1 ~/Desktop/my_usb
# or
sudo mount -r -t msdos /dev/disk3s1 ~/Desktop/my_usb
# Ooorrrr
diskutil unmount /dev/disk2s1
# Format
diskutil erasedisk fat32 VXU MBRFormat /dev/disk2
# Mount in writable mode or read only
diskutil mount /dev/disk2s1
diskutil mount readOnly /dev/disk2s1
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
sudo killall -HUP mDNSResponder
sudo killall ControlStrip
sudo killall coreaudiod

Safari confirm before quit

1- Downlaod FastScripts.app. Open and confirm start on startup.

2- When Safari is open, select FastScripts application icon from right top menu. Go FastScripts->Open Safari Scripts Folder. This will create an empty folder if no folder exists for Safari scripts.

3- Open ScriptEditor.app save following script within Safari scripts folder:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Safari"
	set _window_count to count windows
	set _tab_count to 0
	
	repeat with _w in every window
		set _tab_count to _tab_count + (count tabs of _w)
	end repeat
	set _msg to _window_count & " windows containing " & ¬
		_tab_count & " tabs." as string
	
	display alert ¬
		"Are you sure you want to quit Safari?" message _msg ¬
		buttons {"Cancel", "Quit"} ¬
		giving up after 60
	if button returned of result is "Quit" then quit
end tell

4- Go to FastScripts->Preferences from top menu icon.

5- Click Script Shortcuts tab.

6- Set key binding to /Users/<user>/Library/Scripts -> Applications -> Safari -> <your script name>

shasum -a 256 <file>

Split PDF pages (vertically, horizontally)

Install mupdf-tools toolkit

brew install mupdf-tools

Split PDF pages

# Vetically:
mutool poster -x 2 input.pdf output.pdf

# Horizontally
mutool poster -y 2 input.pdf output.pdf
# start homebrew service
brew services start mysql
# stop
brew services stop mysql
sudo /usr/libexec/locate.updatedb
  • Open "Force Quit" screen
    • CMD + OPTION + ESC
  • Force kill current app without confirmation
    • CMD + OPTION + SHIFT + ESC

--

  • To open any app location:
    • Press CMD and click app icon via mouse
/Applications/VLC.app/Contents/MacOS/VLC screen:// -I rc --screen-fps 25 ":sout=#transcode{vcodec=h264}:std{access=file,dst=screen.mp4}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment