Skip to content

Instantly share code, notes, and snippets.

View fernandoaleman's full-sized avatar

Fernando Aleman fernandoaleman

View GitHub Profile
@fernandoaleman
fernandoaleman / nginx_init_script_centos
Created October 3, 2011 00:53
An Nginx init script for CentOS
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
@fernandoaleman
fernandoaleman / ssh_keys_authentication.sh
Created October 3, 2011 20:45
How to install SSH Keys for authentication without password
# Create ssh private and public keys on your local machine
ssh-keygen -t rsa
# Set permissions on your private key
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
# Copy the public key to the server
scp ~/.ssh/id_rsa.pub root@yourserver.com:~/.ssh/authorized_keys
@fernandoaleman
fernandoaleman / getversion
Created October 16, 2011 04:23
Show Mac OS Version
#!/usr/bin/ruby
module Tty extend self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def reset; escape 0; end
def bold n; escape "1;#{n}" end
def underline n; escape "4;#{n}" end
def escape n; "\033[#{n}m" if STDOUT.tty? end
@fernandoaleman
fernandoaleman / rpm-digital-signature.sh
Created November 18, 2011 15:18
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@fernandoaleman
fernandoaleman / rpm-from-source.sh
Created November 18, 2011 16:34
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild
@fernandoaleman
fernandoaleman / create-repo-metadata.sh
Created November 18, 2011 17:42
Script to create rpm repository metadata
#!/bin/sh
# This is for Redhat 64 bit versions of Linux with `createrepo` installed. If you
# do not have createrepo, you can install it with:
# yum install -y createrepo
# Change DESTDIR path to RPMS directory of your repo
DESTDIR="/var/www/repo/rhel/6"
for ARCH in x86_64
@fernandoaleman
fernandoaleman / how-to-create-an-rpm-repository.sh
Created November 18, 2011 17:57
How to create an RPM repository
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="/stylesheets/bootstrap.css" rel="stylesheet" />
<style type="text/css">
body {
padding-top: 60px;
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@fernandoaleman
fernandoaleman / Gemfile
Created May 8, 2012 16:22 — forked from simi/Gemfile
Refinery + Twitter Bootstrap WIP
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'