Skip to content

Instantly share code, notes, and snippets.

souhaiebtar

Block or report user

Report or block souhaiebtar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View zpreztorc
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@souhaiebtar
souhaiebtar / .vimrc
Last active Sep 1, 2018
vim default config
View .vimrc
call plug#begin('~/.vim/plugged')
" Plugins go here
Plug 'sickill/vim-monokai'
Plug 'tpope/vim-sensible'
Plug 'ekalinin/Dockerfile.vim'
Plug 'mattn/vim-fz'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
@souhaiebtar
souhaiebtar / vim_tmux_setup.sh
Created Jul 15, 2018 — forked from fideloper/vim_tmux_setup.sh
Setup Vim+Vundle+Solarized+Tmux in a Vagrant Ubuntu box. This goes with my article on Vim+Tmux here: http://fideloper.com/mac-vim-tmux
View vim_tmux_setup.sh
#!/usr/bin/env bash
# Bash script to automate Vim+Tmux install as written about here:
# http://fideloper.com/mac-vim-tmux
# Test if Git is installed.
# Installing Git is not the job of this script
git --version 2>&1 >/dev/null
GIT_IS_INSTALLED=$?
@souhaiebtar
souhaiebtar / install.sh
Last active Sep 25, 2018
Post install script ubuntu 1604 shell
View install.sh
#!/usr/bin/env sh
CAN_I_RUN_SUDO=$(sudo -n uptime 2>&1|grep "load"|wc -l)
if [ $CAN_I_RUN_SUDO -ne 0 ]; then
echo "Installing sudo"
apt-get install -y sudo
fi
# function to get distro and version used by vim install
get_distribution_version() {
@souhaiebtar
souhaiebtar / .zshrc
Last active Jul 24, 2018
zshrc file
View .zshrc
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
@souhaiebtar
souhaiebtar / nginx-thingsboard
Created Aug 2, 2018 — forked from mfalkvidd/nginx-thingsboard
Thingsboard nginx reverse proxy with websocket and HTTPS support (Let's Encrypt)
View nginx-thingsboard
server {
listen 80;
server_name EXTERNAL_THINGSBOARD_DOMAIN.com;
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
server {
@souhaiebtar
souhaiebtar / docker-swarm-ports.md
Created Sep 13, 2018 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables
View docker-swarm-ports.md

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

@souhaiebtar
souhaiebtar / login-alert.sh
Created Sep 18, 2018
ssh login email alert #ssh #login #mail
View login-alert.sh
#!/bin/bash
if [ "$PAM_TYPE" != "close_session" ]; then
APK='api:00301be59a4ff645f2db693ba971a23b-8b7bf2f1-568a4476'
FROM='Login Alert <postmaster@email.tsouhaieb.space>'
TO='tarhounisouhaieb@gmail.com'
SUBJECT="Login: $PAM_USER @ email.tsouhaieb.space from $PAM_RHOST"
DATE=$(date)
TEXT="At $DATE a login occurred for $PAM_USER on the VPS from $PAM_RHOST"
curl -s --user $APK \
https://api.mailgun.net/v3/email.tsouhaieb.space/messages \
@souhaiebtar
souhaiebtar / get_latest_release.sh
Created Sep 18, 2018 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
View get_latest_release.sh
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

You can’t perform that action at this time.