This flow is used to generate passcode on command-line in two-step verification.
-
Install brew
-
Install oath
brew install oath-toolkit
| #!/bin/sh | |
| # Run the script as root | |
| MACHINE_ID=$RANDOM | |
| scutil --set ComputerName $MACHINE_ID | |
| scutil --set LocalHostName $MACHINE_ID | |
| scutil --set HostName $MACHINE_ID |
| #!/usr/bin/python | |
| import subprocess | |
| import re | |
| # Get process info | |
| ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0] | |
| vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0] | |
| # Iterate processes |
sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew| CREATE ROLE 'new_username' WITH LOGIN PASSWORD 'new_password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity'; | |
| GRANT CONNECT ON DATABASE 'db_name' TO 'new_username'; | |
| GRANT USAGE ON SCHEMA public TO 'new_username'; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO 'new_username'; | |
| GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO 'new_username'; | |
| GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO 'new_username'; |
| # This gist is compatible with Ansible 1.x . | |
| # For Ansible 2.x , please check out: | |
| # - https://gist.github.com/dmsimard/cd706de198c85a8255f6 | |
| # - https://github.com/n0ts/ansible-human_log | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # |
| #!/bin/sh | |
| LOG=/var/log/fstrim/trim.log | |
| echo "Starting trim $(date -R) " >> $LOG | |
| fstrim -v -a >> $LOG |
create new cron script
touch /etc/cron.daily/cleanup
set executable permission
sudo chmod +x /etc/cron.daily/cleanup