Skip to content

Instantly share code, notes, and snippets.

View srmklive's full-sized avatar

Raza Mehdi srmklive

View GitHub Profile
@srmklive
srmklive / default.conf
Created January 3, 2019 06:42
Nginx Virtual Host Example with Directory Alias
server {
listen 80;
root /var/www/html;
index index.nginx-debian.html index.html index.htm index.php;
access_log off;
error_log /var/log/nginx/error.log error;
charset utf-8;
@srmklive
srmklive / gist:36503506fae68a92e028b75decc05729
Created December 13, 2018 12:04
Install Nginx, PHP 7.2, NodeJS, Yarn & Composer in Ubuntu 16.04 & 18.04
apt-get update \
&& apt-get -y upgrade
add-apt-repository ppa:nginx/stable \
&& add-apt-repository ppa:ondrej/php \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update
@srmklive
srmklive / sendPush.txt
Created December 10, 2018 13:02 — forked from valfer/sendPush.txt
Sending Push Notification with HTTP2 (and PHP) see entire post at: http://coding.tabasoft.it/ios/sending-push-notification-with-http2-and-php/
<?php
/**
* @param $http2ch the curl connection
* @param $http2_server the Apple server url
* @param $apple_cert the path to the certificate
* @param $app_bundle_id the app bundle id
* @param $message the payload to send (JSON)
* @param $token the token of the device
* @return mixed the status code (see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW18)
@srmklive
srmklive / gist:7296716be95f722c783f20126854a382
Created October 31, 2018 21:33 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :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:
@srmklive
srmklive / gist:c9105f88d130f7eb5d9b713ed87d2023
Created October 31, 2018 21:22
(How i fixed) SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
1. First edit the mysql config e.g. /etc/mysql/my.cnf & added the following:
[mysqld]
default_authentication_plugin= mysql_native_password
2. Then run the following command:
mysql_upgrade -u root -p --default-auth=mysql_native_password
3. If above command succeeds, then login into mysql server:
@srmklive
srmklive / gist:2ca197fd9829c5c57e3a3e957ce739b2
Created October 12, 2018 08:13
Atomically delete keys matching a specific pattern in Redis
# Go to redis terminal using command 'redis-cli'. After redis terminal is opened, type in the following command to remove entries:
EVAL "local keys = redis.call('keys', ARGV[1]) \n for i=1,#keys,5000 do \n redis.call('del', unpack(keys, i, math.min(i+4999, #keys))) \n end \n return keys" 0 prefix:*
@srmklive
srmklive / docker-remove-dangling-images.sh
Last active July 18, 2018 06:52
Remove all dangling docker containers
sudo docker rmi --force $(sudo docker images -qa -f 'dangling=true')
@srmklive
srmklive / docker-destroy-all.sh
Last active June 4, 2020 05:25 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
sudo docker stop $(sudo docker ps -a -q)
# Delete all containers
sudo docker rm $(sudo docker ps -a -q)
# Delete all images
sudo docker rmi $(sudo docker images -q)
# Deleta all volumes
sudo docker volume prune -f
# Delete docker networks
# Uncomment the following code to force https mode.
#server {
# listen 80;
# server_name laravel.test;
# return 301 https://laravel.test$request_uri;
#}
server {
listen 80; # comment this line & uncomment the line below to force https mode.
@srmklive
srmklive / gist:b87549aeb9a65da7bf938a13410c30ff
Last active April 11, 2016 09:19
Remove composer error: proc_open(): fork failed - Cannot allocate memory
When running composer commands, sometimes you may see Download exception errors, and also this error message:
```
proc_open(): fork failed - Cannot allocate memory
```
To correct this error, you need to enable swap. You can enable swap by running the following commands:
```
/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096