Skip to content

Instantly share code, notes, and snippets.

# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@mabroor
mabroor / gist:c1e697983b113119fcc3
Last active August 29, 2015 14:20
Disable a service from startup in ubuntu

Enabling / Disabling a service

To toggle a service from starting or stopping permanently you would need to:

echo manual | sudo tee /etc/init/SERVICE.override

where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override. For example:

echo manual | sudo tee /etc/init/mysql.override
{# place this at templates/pages/menus/dropdown.html to override the mezzanine dropdown menu #}
{% load i18n pages_tags %}
{% spaceless %}
{% if page_branch_in_menu %}
{% if branch_level == 0 %}
<ul class="nav pull-right">
{% for page in page_branch %}
{% if page.in_menu %}
{% if page.login_required and request.user.is_authenticated or not page.login_required %}
{% load i18n future pages_tags %}
{% spaceless %}
{% if page_branch_in_menu %}
{% if branch_level == 0 %}
<ul class="menu">
{% for page in page_branch %}
{% if page.in_menu %}
<li>
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@mabroor
mabroor / gist:9530812
Created March 13, 2014 15:39
Fixing shared folder permisson on VirtualBox
sudo adduser xxxxxxx vboxsf
@mabroor
mabroor / upgrade_venv.sh
Created November 26, 2013 09:08
upgrade all pip packages
pip install -U $(pip freeze | awk '{split($0, a, "=="); print a[1]}')
@mabroor
mabroor / gist:5532009
Created May 7, 2013 11:46
render master private ip
10.0.0.1
# Note that target_env.login and target_env.password is global variables
# Maybe I should add this into Fabric project (http://docs.fabfile.org/en/1.4.2/index.html).
# This is complicated task for sure but it would be nice if Fabric could use ssh under Linux and PowerShell Remoting under Windows.
def remote_sh(target_host, command_text, ignore_error=False):
print('run PowerShell script block at {0}: {1}'.format(target_host, command_text))
command_text = command_text.replace('"', '\'')
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.