- using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml- using inventory:
127.0.0.1 ansible_connection=localansible-playbook --connection=local 127.0.0.1 playbook.yml127.0.0.1 ansible_connection=local| location ~ /\.git { | |
| deny all; | |
| } | |
| # or, all . directories/files in general (including .htaccess, etc) | |
| location ~ /\. { | |
| deny all; | |
| } |
| ➜ ~ sw_vers | |
| ProductName: Mac OS X | |
| ProductVersion: 10.12.1 | |
| BuildVersion: 16B2333a | |
| ➜ ~ ls -l /System/Library/Filesystems/apfs.fs/Contents/Resources | |
| total 2088 | |
| -rwxr-xr-x 1 root wheel 349760 22 Sep 03:48 apfs.util | |
| -rwxr-xr-x 1 root wheel 352880 22 Sep 03:48 apfs_invert |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| "syscall" | |
| ) | |
| func main() { |
| <?php | |
| /* | |
| The aim is to create a functional server monitor based on the one | |
| showed on Mark Zuckerberg's monitor on The Social Network movie. | |
| Run so: | |
| php monitor.php | |
| Notes: | |
| - The server LogFormat must be "Common Log Format" (%h %^[%d:%^] "%r" %s %b) |
| from Crypto import HMAC, SHA256 | |
| def hmac_sha256(key, msg): | |
| hash_obj = HMAC.new(key=key, msg=msg, digestmod=SHA256) | |
| return hash_obj.hexdigest() |
| <?php | |
| #source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char | |
| function replace_unicode_escape_sequence($match) { | |
| return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); | |
| } | |
| function unicode_decode($str) { | |
| return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str); | |
| } |
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!| #!/usr/bin/env bash | |
| usage() { | |
| echo "$(basename $0) VM" | |
| } | |
| get_vm_id() { | |
| qm list | awk '/'"${1}"'/ { print $1 }' | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |