Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
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
before_restart.rb | |
node[:deploy].each do |application, deploy_item| | |
run "echo '#{deploy_item.to_json}' >> /tmp/logs.log" | |
end | |
## Note only current_path is availabe, no shared_path or release_path | |
{"home"=>"/home/deploy", | |
"application_type"=>"rails", | |
"mounted_at"=>nil, |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
function logAccess($status = 200) { | |
file_put_contents("php://stdout", sprintf("custom =>[%s] %s:%s [%s]: %sn", | |
date("D M j H:i:s Y"), $_SERVER["REMOTE_ADDR"], | |
$_SERVER["REMOTE_PORT"], $status, $_SERVER["REQUEST_URI"])); | |
} | |
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
resource "aws_instance" "web" { | |
ami = "ami-7f89a64f" | |
instance_type = "t1.micro" | |
ebs_block_device { | |
device_name = "/dev/sdg" | |
volume_size = 5 | |
volume_type = "gp2" | |
delete_on_termination = false | |
} | |
} |
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
version: '2' | |
services: | |
db: | |
image: mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=mypass | |
- constraint:node==node01 | |
networks: | |
- backend |
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
const http = require('http'); | |
const name = 'node-hello-world'; | |
const port = '8888'; | |
const app = new http.Server(); | |
app.on('request', (req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.write('Hello World'); |
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
#Ref: https://github.com/circleci/android-cloud-test-lab/blob/master/circle.yml | |
export DIRECTORY="/var/jenkins_home/GoogleCloudSDK/google-cloud-sdk/bin" | |
if [ ! -d "$DIRECTORY" ]; then | |
# Control will enter here if $DIRECTORY doesn't exist. | |
cd /var/jenkins_home | |
wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip -O google-cloud-sdk.zip | |
unzip -o google-cloud-sdk.zip -d ./GoogleCloudSDK/ | |
./GoogleCloudSDK/google-cloud-sdk/install.sh | |
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
function asyncFunc(e) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(e), e * 1000); | |
}); | |
} | |
const arr = [1, 2, 3]; | |
let final = []; | |
function workMyCollection(arr) { |
OlderNewer