Skip to content

Instantly share code, notes, and snippets.

View ajax13's full-sized avatar

Abir Brahem ajax13

  • Paris
View GitHub Profile
@ajax13
ajax13 / .zshrc
Last active April 1, 2019 07:58
Oh My ZSH config file
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/liamone/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
@ajax13
ajax13 / get_combinations.php
Created June 5, 2018 15:31 — forked from cecilemuller/get_combinations.php
PHP: Get all combinations of multiple arrays (preserves keys)
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
alias dps="docker ps -q | xargs docker inspect --format '{{ .Id }} - {{ .Name }} - {{ .NetworkSettings.IPAddress }}'"
@ajax13
ajax13 / config_sf.sh
Last active November 7, 2017 14:38
Script shell/bash to deploy Symfony
#!/usr/bin/env bash
declare -xr REPOSITORY="https://github.com/xx/yyy.git"
BASE_SSH='ssh'
#export GLOBAL_VAR="value"
#declare -x GLOBAL_VAR="value" #global variable
#readonly CURRENT_SHELL_VAR=value
dev_env() {
#Git config
@ajax13
ajax13 / restrictions.conf
Created October 25, 2017 12:12 — forked from islander/restrictions.conf
nginx.conf
#include conf.d/restrictions.conf;
# disable logging for favicon
location = /favicon.ico {
return 204;
log_not_found off;
access_log off;
}
# disable logging for robots.txt
location = /robots.txt {
@ajax13
ajax13 / secure-nginx.conf
Last active October 25, 2017 12:09 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ajax13
ajax13 / ufw-rules-ubuntu.sh
Last active October 23, 2017 10:35
Set ufw firewall rules.
#!/bin/sh
# disable firewall
sudo ufw disable
# reset all firewall rules
sudo ufw reset --force
# set default rules: deny all incoming traffic, allow all outgoing traffic
sudo ufw default deny incoming
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
1) nginx is used to serve static files (css, js, images, etc.)
2) node serves all the "dynamic" stuff.
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.
3) nginx listens on port 80. 4) node listens on port 8124 (for this example only. you can change this port for your node app).
@ajax13
ajax13 / .bashrc
Last active April 9, 2018 14:20
Custom sell commands
# safety features
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -I' # 'rm -i' prompts for every file
alias ln='ln -i'
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
# display git branch
@ajax13
ajax13 / .gitconfig
Last active March 18, 2019 10:43
Global gitconfig
[color]
ui = true
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = XXX
name = yyy