Skip to content

Instantly share code, notes, and snippets.

View zafranf's full-sized avatar

Zafran Fadilah zafranf

View GitHub Profile
@zafranf
zafranf / sphp
Created November 16, 2022 14:21
macOS switch php version
#!/bin/bash
echo "###########################"
echo "# Choose PHP Version #"
echo "###########################"
echo "1) [email protected]"
echo "2) [email protected]"
echo ""
echo "0) exit"
echo

Server Setup for Ubuntu 20.04

The setup installs the following software:

  • Git
  • Composer
  • Nginx
  • PHP
  • MariaDB
  • Redis
@zafranf
zafranf / nginx-tuning.md
Created May 21, 2020 08:22 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@zafranf
zafranf / media-query.css
Created December 5, 2019 01:08 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@zafranf
zafranf / Update remote repo
Created January 13, 2019 19:11 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@zafranf
zafranf / dir_is_empty.php
Created April 20, 2018 08:54 — forked from mistic100/dir_is_empty.php
[PHP] Check if a folder is empty
<?php
/**
* Check if a directory is empty (a directory with just '.svn' or '.git' is empty)
*
* @param string $dirname
* @return bool
*/
function dir_is_empty($dirname)
{
if (!is_dir($dirname)) return false;
@zafranf
zafranf / default
Created April 14, 2018 14:53 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@zafranf
zafranf / 01-README.md
Created April 14, 2018 14:51 — forked from petemcw/01-README.md
Mac OS X LEMP Configuration

Mac OS X LEMP Configuration

This Gist is a collection of configuration files that can be used to easily setup a Homebrew-based LEMP stack on Mac OS X.

Files in this repository are numbered and named for ordering purposes only. At the top of each file is a section of metadata that denote what component the file belongs to and the default name & location of the file. Feel free to implement it however you want.

Note: some configuration files have hard-coded paths to my user directory -- fix it for your setup

Setup

Server Setup for Debian 8 (jessie)

The setup installs the following software and features:

  • Add a new user
  • Install firewall
  • Nginx
  • PHP
  • MariaDB
  • Git
@zafranf
zafranf / accessh
Created December 20, 2017 05:24
SSH List script
#!/bin/bash
echo "###########################"
echo "# Choose SSH Access #"
echo "###########################"
echo "1) SSH to ..."
echo "0) exit"
echo
printf 'choose [1/2/3/0] : '