Skip to content

Instantly share code, notes, and snippets.

View samehmohamed88's full-sized avatar

Sameh Mohamed samehmohamed88

  • Motional
  • Boston, USA
View GitHub Profile
#!/bin/bash
set -xe
sudo apt-get -y update
sudo apt-get install -y tk8.6-dev libssl-dev sqlite3 libsqlite3-dev \
gcc g++ make libpng-dev libxml2 \
libxml2-dev libxslt1-dev python-dev \
zlib1g-dev libbz2-dev \
#!/bin/bash
set -xe
yum -y update
yum install -y zlib-devel openssl-devel sqlite-devel bzip2-devel xz-libs gcc g++ make wget
# Install Python 2.7.8
curl -o /root/Python-2.7.9.tar.xz https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
tar -xf /root/Python-2.7.9.tar.xz -C /root
cd /root/Python-2.7.9 && ./configure --prefix=/usr/local && make && make altinstall
{"Mappings": {
"TimeBasedAutoScale" : {
"weekend" : {"0":"off","1":"off","2":"off","3":"off","4":"off","5":"off","6":"off","7":"off","8":"off","9":"off","10":"off","11":"off","12":"off","13":"off","14":"off","15":"off","16":"off","17":"off","18":"off","19":"off","20":"off","21":"off","22":"off","23":"off"}
},
"TimerBackendInstance1" : {
"Type": "AWS::OpsWorks::Instance",
"Properties": {
"Architecture" : { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch"]},
"AutoScalingType" : "timer",
#!/usr/bin/env python
"""
This is a script to create instances and set thier auto-scaling for eTech-Campus'
live OpsWorks Stack. The Stack is created using the CloudFormation template
is this directory.
Once the Stack and its single layer are created,
"""
import boto3
def chunk(lst, size):
return [lst[i:i+size] for i in range(0, len(lst), size)]
#instances = my list of instancse
count = len(instances)
size = len(instances)/len(subnets)
num = len(instances)/size
_list = chunk(range(count), size)
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker volume rm $(docker volume ls -qf dangling=true)
@samehmohamed88
samehmohamed88 / gist:2408e70755030aaf5c53
Created October 21, 2015 19:21
Django table template
<table>
<tr>
<td>First Name</td>
<td>Last Name</td>
</tr>
{% for student in students%}
<tr>
<td>{{student.first_name}}</td>
<td>{{student.last_name}}</td>
</tr>
#!/usr/bin/env bash
#install all dependencies in a debian based system
sudo apt-get install -y python-distribute mysql-server mongodb libldap2-dev libsasl2-dev python-ldap libmysqlclient-dev python-dev unixodbc-dev libxml2-dev libxslt1-dev
#install pip to manage virtualenv
sudo easy_instal pip
#install a nice to use virtualenv utitlity
sudo pip install virtualenvwrapper
#this gist prints the git branch as well as the virtualenv name on the prompt
curl https://gist.githubusercontent.com/webiken/71aa48d381c231513f3e/raw/a7f10c73c1f48e7713eb7df00e83c37b6716970e/bash_profile > ~/.bash_profile
# bash_prompt
# The various escape codes that we can use to color our prompt.
RED="\[\033[0;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
@samehmohamed88
samehmohamed88 / bootstrap.sh
Last active January 2, 2016 20:59
Very simple bootstrap script to create an admins group and add an admin user in that group, then modify sudoers to have PASSWORD LESS sudo access for group admins
groupadd admins
adduser admin
usermod -g admins admin
vim /etc/sudoers
#we need to give the admins group PASSWORDLESS SUDO
#this is done by adding
# %admins ALL=(ALL) NOPASSWD:ALL
#now we set the hostname