Skip to content

Instantly share code, notes, and snippets.

View samukasmk's full-sized avatar

Samuel Sampaio samukasmk

View GitHub Profile
# 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
@samukasmk
samukasmk / thread1.py
Last active August 29, 2015 14:27 — forked from zeldani/thread1.py
#!/usr/bin/python:
import thread
import time
def print_time (nomedothread, delay):
conta = 0
while conta < 5:
time.sleep(delay)
conta += 1
print "%s: %s" % (nomedothread, time.ctime(time.time()) )
@samukasmk
samukasmk / rbenv-howto.md
Last active December 27, 2019 14:13 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev