This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| // uuid returns an RFC 4122 compliant universally unique | |
| // identifier using the crypto API | |
| function uuid() { | |
| // get sixteen unsigned 8 bit random values | |
| var u = window | |
| .crypto | |
| .getRandomValues(new Uint8Array(16)); | |
| // set the version bit to v4 |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| # === Terminal.app === # | |
| # Open new tab in terminal. | |
| exec("osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' > /dev/null 2>&1 ") | |
| # Open directory | |
| exec("osascript -e 'tell application \"Terminal\" to do script \"cd directory\" in selected tab of the front window' > /dev/null 2>&1 ") | |
| # Open directory in new tab (this is better) | |
| exec("osascript -e 'tell application \"Terminal\"' -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' -e 'do script with command \"cd directory && clear\" in selected tab of the front window' -e 'end tell' > /dev/null 2>&1") |
| # SYNTAX: | |
| var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches) | |
| var pattern = /pattern/attributes; # same as above | |
| # BRACKETS: | |
| [...]: Any one character between the brackets. | |
| [^...]: Any one character not between the brackets. |
| docker build -t friendlyname . # Create image using this directory's Dockerfile | |
| docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80 | |
| docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode | |
| docker exec -it [container-id] bash # Enter a running container | |
| docker ps # See a list of all running containers | |
| docker stop <hash> # Gracefully stop the specified container | |
| docker ps -a # See a list of all containers, even the ones not running | |
| docker kill <hash> # Force shutdown of the specified container | |
| docker rm <hash> # Remove the specified container from this machine | |
| docker rm $(docker ps -a -q) # Remove all containers from this machine |
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |
| # check for an update on a web-page, and email the user | |
| import httplib | |
| import sys | |
| import pickle | |
| from datetime import datetime | |
| import smtplib | |
| from email.mime.text import MIMEText | |
| import yaml | |
| def email_user(cur_data, email_from, email_to): |
| #!/bin/bash | |
| # inspired in "Monitoring a web page for changes using bash" | |
| # http://bhfsteve.blogspot.com.es/2013/03/monitoring-web-page-for-changes-using.html | |
| # monitor.sh - Monitors a web page for changes | |
| # sends an email notification and a tweet if the file changes | |
| # requirements: | |
| # - twitter from the command line [https://github.com/sferik/t] | |
| # gem install t | |
| # - sendemail |