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
## Install NGINX | |
## when installing on Amazon Linux AMI, use: | |
$ sudo yum install nginx -y | |
## when installing on Amazon Linux 2 AMI, use | |
$ sudo amazon-linux-extras install nginx1.12 -y | |
## Install PHP and PHP-FPM | |
# for PHP version 7.1 use php71 and php71-fpm instead | |
$ sudo yum install php -y | |
$ sudo yum install php-fpm -y |
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
// sending to sender-client only | |
socket.emit('message', "this is a test"); | |
// sending to all clients, include sender | |
io.emit('message', "this is a test"); | |
// sending to all clients except sender | |
socket.broadcast.emit('message', "this is a test"); | |
// sending to all clients in 'game' room(channel) except sender |
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 | |
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` | |
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` | |
token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | sed -n '/Token/{p;}' | cut -f4 -d'"'` | |
file="somefile.deb" | |
bucket="some-bucket-of-mine" | |
date="`date +'%a, %d %b %Y %H:%M:%S %z'`" |
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
Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along | |
Simple steps: | |
1. On ubuntu based systems, run " $ sudo visudo " | |
2. this will open /etc/sudoers file. | |
3. If your jenkins user is already in that file, then modify to look like this: | |
jenkins ALL=(ALL) NOPASSWD: ALL | |
4. save the file by doing Ctrl+O (dont save in tmp file. save in /etc/sudoers, confirm overwrite) | |
5. Exit by doing Ctrl+X | |
6. Relaunch your jenkins job |
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
$ cd ~ | |
$ sudo curl -sS https://getcomposer.org/installer | sudo php | |
$ sudo mv composer.phar /usr/local/bin/composer | |
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer | |
then you can run | |
$ sudo composer install |