brew install dnsmasq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Creating an SSH key for you..." | |
| ssh-keygen -t rsa | |
| echo "Please add this public key to Github \n" | |
| echo "https://github.com/account/ssh \n" | |
| read -p "Press [Enter] key after this..." | |
| echo "Installing xcode-stuff" | |
| xcode-select --install |
Changes with .dev domains in
mind.
Create /etc/pf.anchors/dev, containing:
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pull the official mongo docker container | |
| docker pull mongo | |
| # create network | |
| docker network create my-mongo-cluster | |
| # create mongos | |
| docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017 | |
| docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018 | |
| docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019 |
Check open ports from within an instance:
- TCP
netstat -ntlp - UDP
netstat -nulp
Check whether port is open from outside:
- TCP
nc -z -w3 domain.com 80 - UDP
nc -z -u -w3 domain.com 1194
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| usage="Usage: $(basename "$0") region stack-name [aws-cli-opts] | |
| where: | |
| region - the AWS region | |
| stack-name - the stack name | |
| aws-cli-opts - extra options passed directly to create-stack/update-stack | |
| " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { CALL_API } from 'redux-api-middleware' | |
| export function fetchLocations() { | |
| return { | |
| [CALL_API]: { | |
| endpoint: 'http://api.somesite.com/api/locations', | |
| method: 'GET', | |
| // Don't have to manually add the Authorization header to every request. | |
| headers: { 'Content-Type': 'application/json' }, | |
| types: ['REQUEST', 'SUCCESS', 'FAILURE'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { CALL_API } from 'redux-api-middleware' | |
| export function fetchLocations() { | |
| return { | |
| [CALL_API]: { | |
| endpoint: 'http://api.somesite.com/api/locations', | |
| method: 'GET', | |
| // Don't have to manually add the Authorization header to every request. | |
| headers: { 'Content-Type': 'application/json' }, | |
| types: ['REQUEST', 'SUCCESS', 'FAILURE'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#hello").removeClass (function (index, css) { | |
| return (css.match (/(^|\s)color-\S+/g) || []).join(' '); | |
| }); | |
| console.log($("#hello")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var get_query_string_parameter = function(name) { | |
| name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
| var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
| results = regex.exec(location.search); | |
| return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
| }; |