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
| ###### Install Apache/httpd and PHP | |
| # Before you begin any installation, make sure that your software is up to date: | |
| sudo yum update | |
| #Install Apache: | |
| sudo yum install httpd | |
| #Start Apache: | |
| sudo systemctl start httpd.service | |
| #Set Apache to start on server boot: | |
| sudo systemctl enable httpd.service |
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
| <template> | |
| <div class=""> | |
| <header class="jumbotron"> | |
| <h3> Products </h3> | |
| <div class="d-flex justify-content-start mb-3"> | |
| <router-link :to="{name: 'products-add', params: {siteId: siteId}}" class="btn btn-sm btn-outline-secondary"><b-icon-plus></b-icon-plus>Add product | |
| </router-link> | |
| </div> | |
| <div> | |
| <button class="btn btn-toolbar" type="submit" @click="runRestock()"><b-icon-caret-right-fill></b-icon-caret-right-fill> Run restock</button> |
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
| <?php | |
| namespace App\Rules; | |
| use Illuminate\Contracts\Validation\Rule; | |
| class Uppercase implements Rule | |
| { | |
| public function passes($attribute, $value) | |
| { |
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
| ################################################################################ | |
| # Method 1: Install using rpm packages (credit to DarkMukke) | |
| # | |
| rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
| rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7 | |
| # WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step | |
| # make sure to at least run `yum install sudo` | |
| yum -y remove vim-minimal vim-common vim-enhanced |
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
| /* | |
| * Genarate rsa keys. | |
| */ | |
| package main | |
| import ( | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/x509" |
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
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| // Exercise: Stringers | |
| // Make the IPAddr type implement fmt.Stringer to print the address as a dotted quad. | |
| // For instance, IPAddr{1, 2, 3, 4} should print as "1.2.3.4". |
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
| //This script is to copy S3 object to GCS in asynchronously using Lambda function | |
| //set var "gcp_proj_id" with value of you GCP project ID | |
| //set var "gcp_client_email" with value of your client email address from JSON key file & make sure that user has GCS create object permission | |
| //set var "cred_bucket", here provode a s3 bucket from where lambsa will fetch the JSON creds file to GCP auth | |
| //Set vat "cred_s3_obj", here you provide a json keyfile name which is uploaded in "cred_bucket" s23 bucket | |
| //**NOTE**: set HOME env var with value "/tmp" in lambda function, because google-cloud/storage create file locally & in lambda only /tmp is writable. Run lambda function on S3 create object event based. | |
| // | |
| 'use strict'; |
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
| // XMLHttpRequest | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('POST', url, true); | |
| xhr.responseType = 'arraybuffer'; | |
| xhr.onload = function () { | |
| if (this.status === 200) { | |
| var filename = ""; | |
| var disposition = xhr.getResponseHeader('Content-Disposition'); | |
| if (disposition && disposition.indexOf('attachment') !== -1) { | |
| var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; |
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
| [master my.cnf] | |
| server-id = 1 | |
| log_bin = /var/log/mysql/mysql-bin.log | |
| binlog_do_db = newdatabase | |
| => /etc/init.d/mysql restart | |
| [permission on replicate] | |
| GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password'; |
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
| apt-get install php5-xhprof | |
| pecl install xhprof | |
| php.ini | |
| extension=xhprof.so | |
| xhprof.output_dir=/var/log/xhprof | |
| php -i | grep xhprof | |
| => /etc/php5/cli/conf.d/xhprof.ini | |
| xhprof | |
| xhprof => 0.9.2 |