Skip to content

Instantly share code, notes, and snippets.

View samukasmk's full-sized avatar

Samuel Sampaio samukasmk

View GitHub Profile
@samukasmk
samukasmk / smk_magento_resizer.php
Last active December 21, 2015 22:08
smk_magento_resizer.php - Resizes Images for isolated/specific magento (admin) server
<?php
/*
smk_magento_resizer.php
Resizes Images for isolated/specific magento (admin) server
Created By: Samuel Maciel Sampaio ([email protected]) [20130828]
References where I got the core:
http://stackoverflow.com/questions/2474117/how-to-get-a-products-image-in-magento
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget -o jdk-7u1-linux-i586.rpm --no-check-certificate --no-cookies --header "Cookie: gpw_e24=xxx;" http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Install Java
sudo rpm -i jdk-7u1-linux-i586.rpm
# Check if the default java version is set to sun jdk
#!/bin/bash
#
# Carbon (part of Graphite)
#
# chkconfig: 3 50 50
# description: Carbon init.d
. /etc/rc.d/init.d/functions
prog=carbon
RETVAL=0
#!/usr/bin/env python
"""
Nagios plugin to check PostgreSQL 9 streaming replication lag.
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install).
MIT licensed:
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved.
def bytes_converter(bytes, from_unit, to_unit, bsize=1024):
"""
Converted bytes units
>>> bytes_converter('2', 'gigabyte', 'kilobyte')
2097152.0
>>> bytes_converter('2097152', 'kilobyte', 'gigabyte')
2.0
"""

Puppet with Jenkins

Setup Jenkins

With Puppet:

puppet module install rtyler-jenkins

puppet apply -v -e "include jenkins"

"""
Tasks for managing a test server
"""
import os
from fabric.api import cd, env, prefix, run, sudo, task
from fabric.contrib.files import exists, sed
from fabric.context_managers import hide
from fabric.colors import green, red
# from fabric.api import *
# from fabric.colors import green as _green, yellow as _yellow
from boto.ec2.connection import EC2Connection
import time
# def start_machine(ami='ami-d7a18dbe'):
'''Launch a single instance of the provided ami'''
aws_access_key_id = 'Cf7...'
@samukasmk
samukasmk / check_git_remote_changes.sh
Created January 17, 2014 17:54
Cron Job like git hook, to inform the Jenkins|Hudson ScriptTrigger Plugin to do a build. - by Samuel Maciel Sampaio
#!/bin/bash#
#
# check_git_remote_changes.sh
# By: Samuel Maciel Sampaio <20140115>
#
# Cron Job like git hook, to inform the Jenkins|Hudson
# ScriptTrigger Plugin to do a build.
# Plugin: https://wiki.jenkins-ci.org/display/JENKINS/ScriptTrigger+Plugin
GIT_REPO_FOLDER=$1
@samukasmk
samukasmk / backup-mysql-magento-stores.sh
Last active August 29, 2015 13:57
backup-mysql-magento-stores.sh - Make easy backups of mysql databases for magento stores
#!/bin/bash
#
# Goal: Make backup of mysql databases for magento stores
# Created by: Samuel Maciel Sampaio [20120901] [20140321]
# Contact: [email protected] <smktecnologia.com.br>
# Needed Applications:
# - mysql
# - mysqldump
# - s3put