Skip to content

Instantly share code, notes, and snippets.

View singularitti's full-sized avatar
:octocat:
WFH

Qi Zhang singularitti

:octocat:
WFH
View GitHub Profile
@singularitti
singularitti / free.py
Last active July 9, 2018 02:13
A Python script that can show the wired, active, inactive and free memory amounts #macOS #memory
#!/usr/bin/env python3
"""
Code referenced from `Stack Exchange \
<https://apple.stackexchange.com/questions/4286/is-there-a-mac-os-x-terminal-version-of-the-free-command-in-linux-systems>`_.
**Note**: One need to use Python 3 to run this file!
"""
import re
import subprocess
@singularitti
singularitti / eos_fit.py
Last active March 20, 2019 06:28
Several methods for equation of state (EoS) fitting #Python
#!/usr/bin/env python3
# Created at May 2, 2018, by Qi Zhang
from abc import abstractmethod
import numpy as np
import scipy.optimize as optimize
class EOS:
@singularitti
singularitti / rmcache.sh
Last active July 9, 2018 02:13
Remove icon caches for macOS #macOS
#!/usr/bin/env bash
find /private/var/folders/ -name com.apple.dock.iconcache -exec trash {} \;
find /private/var/folders/ -name com.apple.iconservices -exec trash {} \;
trash /Library/Caches/com.apple.iconservices.store
@singularitti
singularitti / quit_finder.sh
Last active May 22, 2023 05:42
Show "Quit Finder" Menu Item #macOS #Finder
# Makes possible to see Finder menu item "Quit Finder" with default shortcut Cmd + Q.
# Enable
defaults write com.apple.finder QuitMenuItem -bool true && killall Finder
# Disable (Default)
defaults write com.apple.finder QuitMenuItem -bool false && killall Finder
@singularitti
singularitti / show_active_apps.sh
Last active August 9, 2019 01:38
Show Only Active Applications #macOS #Dock
# Enable
defaults write com.apple.dock static-only -bool true && \
killall Dock
# Disable (Default)
defaults write com.apple.dock static-only -bool false && \
killall Dock
@singularitti
singularitti / enable_unidentified_developer.sh
Last active August 9, 2019 01:37
Open a Mac app from an unidentified developer #macOS #security
sudo spctl --master-disable
@singularitti
singularitti / accent_menu.sh
Created July 21, 2018 21:43
Enable the Character Accent Menu
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true
@singularitti
singularitti / reset_credential.sh
Created August 17, 2018 02:39
Remove credentials from Git #Git
git config --global credential.helper store
@singularitti
singularitti / transmit_pasteurl.sh
Created October 8, 2018 05:12
Don't paste login information #Transmit
# When copying a remote item’s URL, don’t include the login information (user:password@example.com) in the URL.
defaults write com.panic.Transmit CopyURLWithoutLogin 0
@singularitti
singularitti / suck_dock.sh
Created November 26, 2018 05:57
Defines the animation which is used to show windows being minimized into the Dock #macOS #Dock
defaults write com.apple.dock mineffect -string 'suck'; killall Dock