Skip to content

Instantly share code, notes, and snippets.

View nuhil's full-sized avatar
🎯
Focusing

Nuhil Mehdy nuhil

🎯
Focusing
View GitHub Profile

#Unix Tips & Tricks
Install imagemagick package
sudo apt-get install imagemagick php5-imagick

Exporting Path (Mac OSX)
a. In your ~/.bash_profile add the path ~/.composer/vendor/bin like following
export PATH=blahblahblah:~/.composer/vendor/bin:$PATH
b. Then reload
source ~/.bash_profile
c. Check if its added correctly

@nuhil
nuhil / nginx-header-by-php
Created March 6, 2015 15:12
Nginx - Get header data by PHP
<?php
foreach (getallheaders() as $name => $value) {
echo $name.':'.$value;
}
@nuhil
nuhil / nginx-vhosts.md
Last active August 29, 2015 14:16
Nginx Create Virtual Host

Create Virtual Hosts in Nginx @Ubuntu

1. Setup


sudo apt-get install nginx

2. Create new directory


sudo mkdir -p /var/www/example.com/public_html

3. Give permissions

@nuhil
nuhil / supervisord.md
Last active August 29, 2015 14:17
supervisord troubleshoot

1. Check which supervisor process is running with which configuration


ps -ef | grep supervisord

2. Should get following output in terminal


root      2204     1  0 22:57 ?        00:00:00 /usr/bin/python /usr/bin/supervisord -c supervisor.conf
ubuntu    2791  1394  0 23:10 pts/0    00:00:00 grep --color=auto supervisord
@nuhil
nuhil / LEMP.md
Last active November 14, 2015 02:08

#Initializing a VPS and Installing LEMP in Ubuntu 14.04 LTS

##Initial Server Configuration

1. Log in to the new server as root
ssh root@SERVER_IP_ADDRESS

2. Create a New User
adduser demo

@nuhil
nuhil / readfile.c
Last active February 18, 2016 05:52
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*
Query Example: It will find out the lines that has a number 3 (May be day/month) infront of it.
./readfile query 3
Add Example: It will add a new line "New Event" with a number 3 (May be day/month) infront of it for later access.
@nuhil
nuhil / Virtual-Machine-Troubles.md
Last active May 11, 2016 10:21
Virtual Box, Vagrant, Homestead, PuPHPet, Sequel Pro - Trouble Shooting!

VM Troubleshoots

Connect Homestead's mySQL through Sequel Pro


Host: 127.0.0.1
Username: homestead
Pass: secret
Port: 33060

Sequel Pro can't connect to Vagrant (Puphpet) Ubuntu's mySQL


@nuhil
nuhil / HTTP-STATUS-CODES.md
Last active May 11, 2016 10:22
HTTP Status Code Definitions - Can be Used While Developing REST API

HTTP Status Code Definitions

Informational 1xx

This class of status code indicates a provisional response.

Code Text Description
100 Continue The client SHOULD continue with its request.
101 Switching Protocols The server understands and is willing to comply with the client's request.
@nuhil
nuhil / property.py
Created July 22, 2016 15:37
Python Property
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
self._pineapple_allowed = False
@property
def pineapple_allowed(self):
return self._pineapple_allowed
@pineapple_allowed.setter
@nuhil
nuhil / bongabdo-usage.js
Last active June 4, 2017 09:00
gist for bongabdo jQuery plugin
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="jquery.bongabdo.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.bongabdo').bongabdo();
});
</script>