Skip to content

Instantly share code, notes, and snippets.

View ZeroDeth's full-sized avatar
🏠
Working from home

Sherif Abdalla ZeroDeth

🏠
Working from home
View GitHub Profile
@ZeroDeth
ZeroDeth / GitHub-Repo-Name.sh
Created June 22, 2017 17:55
Create a new repo at Github using git bash?
#!/bin/sh
# Create a new repo at Github using git bash?
reponame="$1"
if [ "$reponame" = "" ]; then
read -p "Enter Github Repository Name: " reponame
fi
mkdir ./$reponame
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
## zsh tmux settings
ZSH_TMUX_AUTOSTART='true'
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
@ZeroDeth
ZeroDeth / memReport.py
Created June 23, 2017 20:30
Mac OS X Terminal version of the “free” command in Linux systems
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0].decode()
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0].decode()
# Iterate processes
@ZeroDeth
ZeroDeth / memInfo.py
Created June 23, 2017 20:45
Print system memory information.
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Print system memory information.
$ python scripts/meminfo.py
@ZeroDeth
ZeroDeth / ntp.sh
Created June 27, 2017 16:36
Checks and ensures that the ntpd service is started and running, and sets it to start at system boot.
#!/bin/bash
# Check if ntp is installed, and, if not, install it.
if ! rpm -qa | grep -qw ntp; then
yum install -y ntp
fi
# Start ntpd if it's not already running.
if ps aux | grep -v grep | grep "[n]tpd" > /dev/null
then
@ZeroDeth
ZeroDeth / devopsTools.sh
Last active July 14, 2017 18:12
Install terraform v0.9.5, packer v0.10.2, ansible v2.0.0.2, docker.io v1.12.6, awscli, ebcli and update ubuntu packages.
#!/bin/bash
set -x
TERRAFORM_VERSION="0.9.5"
PACKER_VERSION="0.10.2"
# create new ssh key
[[ ! -f /home/ubuntu/.ssh/hostykey ]] \
&& mkdir -p /home/ubuntu/.ssh \
&& ssh-keygen -f /home/ubuntu/.ssh/hostykey -N '' \
&& chown -R ubuntu:ubuntu /home/ubuntu/.ssh
---
- hosts: all
become: yes
tasks:
- name: Ensure NTP (for time synchronization) is installed.
yum: name=ntp state=present
- name: Ensure NTP is running.
service: name=ntpd state=started enabled=yes
@ZeroDeth
ZeroDeth / .tmux.conf
Last active July 19, 2017 10:16
Tmux Configuration
# set shell
set -g default-shell /bin/zsh
# set window number to start from number
set -g base-index 1
###########################################################################
# General options
# Watch for activity in background windows
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# openssl
export PATH="/usr/local/opt/openssl/bin:$PATH"
# export PATH="$PATH:/usr/local/Cellar/openssl/1.0.2h/bin/openssl"
# sqlite
export PATH="/usr/local/opt/sqlite/bin:$PATH"
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="/usr/local/bin:/usr/bin:$PATH"
# homebrew=/usr/local/bin:/usr/local/sbin
# export PATH=$homebrew:$PATH
# modify your PATH variable