Skip to content

Instantly share code, notes, and snippets.

View chishiuanlu's full-sized avatar
👍

Lu chishiuanlu

👍
View GitHub Profile
@thelinuxlich
thelinuxlich / docker-compose.yml
Created June 9, 2017 03:55
Redis Cluster with Docker Compose v3
version: "3.1"
services:
redis-master-1:
build: ./
networks:
redisnet:
ipv4_address: 10.0.0.2
command: sh -c "redis-server /src/redis.conf --port 7000 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000"
redis-master-2:
build: ./
@mavieth
mavieth / install-php-7.sh
Created May 2, 2017 01:38
Upgrade from PHP 5.X.X to PHP 7 on an AWS EC2 Linux Server
#!/bin/bash
echo "==============================="
echo "Installing PHP 7"
echo "==============================="
sudo yum install php70
echo "==============================="
echo "Installing PHP 7 additional commonly used php packages"
echo "==============================="
@tokkonopapa
tokkonopapa / class-zcloudfront.php
Last active April 23, 2018 14:37
IP Geo Block api class library for CloudFront
<?php
if ( class_exists( 'IP_Geo_Block_API', FALSE ) ) :
/**
* Class for CloudFront
*
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustomIPAddresses
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#request-custom-headers-behavior
@nrollr
nrollr / Commands.sh
Last active January 10, 2023 11:55
Install PHP and NGINX on Amazon Linux AMI
## 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
@subfuzion
subfuzion / curl.md
Last active July 3, 2024 11:43
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Integralist
Integralist / Install Redis CLI on AWS Instance.md
Last active May 30, 2023 02:58
Install Redis CLI on AWS Instance
  • ssh 10.6.11.62,eu-west-1
  • sudo yum install gcc
  • sudo yum install wget
  • wget http://download.redis.io/redis-stable.tar.gz
  • tar xvzf redis-stable.tar.gz
  • cd redis-stable
  • make
  • src/redis-cli -h mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com -p 6379

Now run redis commands:

@jcefoli
jcefoli / allkeys.php
Last active November 21, 2022 11:11
List All Key/Value Pairs in Redis using the Predis Library. Assumes that Redis is running locally on default port 6379 with no password auth
<?
//Include Predis library. See https://github.com/nrk/predis for more info
require "Predis/Autoloader.php";
//Connect to Redis
Predis\Autoloader::register();
try {
$redis = new Predis\Client();
$redis = new Predis\Client(array(
"scheme" => "tcp",
@ktheory
ktheory / dd.log
Last active November 10, 2023 23:41
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
@yuta-imai
yuta-imai / UserData script for setup CloudWatch
Last active March 13, 2022 01:28
With this user data script, you can set up cron job to put some custom metrics for CloudWatch at instance initiation.
#!/bin/sh
cd /home/ec2-user
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip CloudWatchMonitoringScripts-v1.1.0.zip
rm CloudWatchMonitoringScripts-v1.1.0.zip
chown ec2-user:ec2-user aws-scripts-mon
echo "*/5 * * * * ec2-user /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron" >> /etc/crontab
@sumardi
sumardi / nginx.default.conf
Last active November 3, 2023 18:49
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \