Skip to content

Instantly share code, notes, and snippets.

View souhaiebtar's full-sized avatar
:octocat:
Focusing

souhaiebtar

:octocat:
Focusing
View GitHub Profile
@souhaiebtar
souhaiebtar / zpreztorc
Created July 15, 2018 06:51
zpreztorc file
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@souhaiebtar
souhaiebtar / vim_tmux_setup.sh
Created July 15, 2018 21:33 — 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
#!/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 / .zshrc
Last active July 24, 2018 12:13
zshrc file
#
# 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 August 2, 2018 10:18 — forked from mfalkvidd/nginx-thingsboard
Thingsboard nginx reverse proxy with websocket and HTTPS support (Let's Encrypt)
server {
listen 80;
server_name EXTERNAL_THINGSBOARD_DOMAIN.com;
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
server {
@souhaiebtar
souhaiebtar / .vimrc
Last active September 1, 2018 18:57
vim default config
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 / docker-swarm-ports.md
Created September 13, 2018 10:23 — 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

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 September 18, 2018 22:44
ssh login email alert #ssh #login #mail
#!/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 September 18, 2018 23:46 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
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

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

Keybase proof

I hereby claim:

  • I am souhaiebtar on github.
  • I am tsouhaieb (https://keybase.io/tsouhaieb) on keybase.
  • I have a public key ASB5thOwU7VEYTagEGRBJB2AB7gEn6g31vihxfGXRWcY3wo

To claim this, I am signing this object: