You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
| <?php | |
| use Doctrine\ORM\Mapping as ORM; | |
| use Doctrine\Common\Collections\ArrayCollection; | |
| /** | |
| * @ORM\Entity() | |
| * @ORM\Table(name="user") | |
| */ | |
| class User |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');| /** | |
| * Generate and return a random characters string | |
| * | |
| * Useful for generating passwords or hashes. | |
| * | |
| * The default string returned is 8 alphanumeric characters string. | |
| * | |
| * The type of string returned can be changed with the "type" parameter. | |
| * Seven types are - by default - available: basic, alpha, alphanum, num, nozero, unique and md5. | |
| * |
| server { | |
| listen 80; | |
| return 301 https://$server_name$request_uri; # enforce https | |
| } | |
| server { | |
| listen 443 ssl; | |
| ssl_certificate your_certificate_filename; | |
| ssl_certificate_key your_certificate_key; |
People
:bowtie: |
π :smile: |
π :laughing: |
|---|---|---|
π :blush: |
π :smiley: |
:relaxed: |
π :smirk: |
π :heart_eyes: |
π :kissing_heart: |
π :kissing_closed_eyes: |
π³ :flushed: |
π :relieved: |
π :satisfied: |
π :grin: |
π :wink: |
π :stuck_out_tongue_winking_eye: |
π :stuck_out_tongue_closed_eyes: |
π :grinning: |
π :kissing: |
π :kissing_smiling_eyes: |
π :stuck_out_tongue: |
| #!/usr/bin/env bash | |
| ##### | |
| # Script to install postfix | |
| ##### | |
| DOMAIN="example.com" | |
| EMAIL="[email protected]" | |
| PASSWORD="example.com1*" |
| # Let us consider the following typical mysql backup script: | |
| mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database | |
| # It succeeds but stderr will get: | |
| # Warning: Using a password on the command line interface can be insecure. | |
| # You can fix this with the below hack: | |
| credentialsFile=/mysql-credentials.cnf | |
| echo "[client]" > $credentialsFile | |
| echo "user=$mysqlUser" >> $credentialsFile | |
| echo "password=$mysqlPassword" >> $credentialsFile |
| * Feel free to improve it. | |
| * Original by Janich: https://gist.github.com/janich/6121771 | |
| * | |
| * @requires PHP 5.3+ | |
| * @package ExportMySQLUsers | |
| * @author Zaid Daba'een | |
| * @license http://www.dbad-license.org/ DBAD license | |
| */ | |
| // Set up database root credentials | |
| $host = 'localhost'; |
| #!/bin/bash | |
| # Install dependencies only for Docker. | |
| [[ ! -e /.dockerinit ]] && exit 0 | |
| set -xe | |
| # Update packages and install composer and PHP dependencies. | |
| apt-get update -yqq | |
| apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev phpunit -yqq |