NOTE: This used to be a gist that continually expanded. It's now a github project because it's considerably easier for other people to edit, fix and expand on Docker using Github. Just click README.md, and then on the "writing pen" icon on the right to edit.
This file contains 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
# good git book | |
http://git-scm.com/book | |
# Discard uncommitted changes in a specific file | |
git checkout file_name | |
# Clear everything not in repo | |
git checkout -- . | |
# A way to quickly move to the previous commit in a git branch. This also way for "deleting" last commit. |
This file contains 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
# Problem Statement | |
# Create a class Calculator, which performs addition and subtraction of two numbers at a time. | |
class Calculator | |
def add(a, b) | |
a+b | |
end | |
def subtract(a, b) | |
a-b | |
end |
This file contains 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
#!/bin/bash | |
PUBLIC_IP4_IFACE=eth2 | |
LISTEN_IFACE=${PUBLIC_IP4_IFACE} | |
listen_address=$(ip -f inet addr show dev ${LISTEN_IFACE} | grep -Po 'inet \K[\d.]+') | |
listen_port=${1} | |
target_host=${2} | |
target_port=${3} |
This file contains 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
#!/bin/sh | |
# This is a skeleton of a bash daemon. To use for yourself, just set the | |
# daemonName variable and then enter in the commands to run in the doCommands | |
# function. Modify the variables just below to fit your preference. | |
daemonName="DAEMON-NAME" | |
pidDir="." | |
pidFile="$pidDir/$daemonName.pid" |
This file contains 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
# UPDATED 17 February 2019 | |
# Redirect all HTTP traffic to HTTPS | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name www.domain.com domain.com; | |
return 301 https://$host$request_uri; | |
} | |
# SSL configuration |
This file contains 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
curl -s -X GET http://localhost:8080/pdb/query/v4/facts --data-urlencode query@test --data-urlencode 'pretty=true' | |
curl -X POST http://localhost:8080/pdb/query/v4/facts \ | |
-H 'Content-Type:application/json' \ | |
-d '{"query":["and",["=","certname","FQDN"],["=","name","ipaddress"]]}' | |
content of file test : | |
["and",["=","certname","FQDN"],["or",["=","name","ipaddress"]]] |
This file contains 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
#place in /etc/letsencrypt/renewal-hooks/post | |
export AWS_ACCESS_KEY_ID=XXX | |
export AWS_SECRET_ACCESS_KEY=XXX | |
#certs must be in us-east-1 to use with cloudfront | |
export AWS_DEFAULT_REGION=us-east-1 | |
#run without --certificate-arn first time then specify arn for updates | |
aws acm import-certificate --certificate file:///etc/letsencrypt/live/site.com/cert.pem --private-key file:///etc/letsencrypt/live/site.com/privkey.pem --certificate-chain file:///etc/letsencrypt/live/site.com/chain.pem --certificate-arn specifyarnforupdate |
NewerOlder