Skip to content

Instantly share code, notes, and snippets.

View lonefreak's full-sized avatar

Fabricio Leotti lonefreak

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lonefreak on github.
  • I am leotti (https://keybase.io/leotti) on keybase.
  • I have a public key ASAu5hhpdmKNyQ9x7K4DmwoWyN9oyLeyKhjGj1ifsffkQgo

To claim this, I am signing this object:

@lonefreak
lonefreak / htcheck.sh
Created November 23, 2015 13:10
Parse information from /proc/cpuinfo to help check if HT is enabled
#!/bin/sh
CPUFILE=/proc/cpuinfo
test -f $CPUFILE || exit 1
NUMPHY=`grep "physical id" $CPUFILE | sort -u | wc -l`
NUMLOG=`grep "processor" $CPUFILE | wc -l`
if [ $NUMPHY -eq 1 ]
then
echo This system has one physical CPU,
else
echo This system has $NUMPHY physical CPUs,
@lonefreak
lonefreak / cleanup-docker.sh
Last active December 3, 2019 20:46
Cleaning Up Old/Unused/All Docker Containers/Images
# removing old containers
# linux
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
# macosx
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs -L 10 docker rm
# removing all stopped containers
# linux
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs --no-run-if-empty docker rm
# macosx
@lonefreak
lonefreak / shared_folder_centos_virtualbox.txt
Last active September 1, 2015 07:26 — forked from larsar/shared_folder_centos_virtualbox.txt
Mount shared folder on CentOS in VirtualBox
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
reboot
@lonefreak
lonefreak / pick_a_language
Created March 10, 2015 01:14
A short ruby program to randomly choose between some programming languages
#! /usr/bin/ruby
#pick a programming language
def get_language()
known_languages = ["ruby","javascript","php","java","perl"]
special_languages = ["python","go","scala","clojure","groovy"]
roll = rand(0..5)
return special_languages[roll] unless roll == 5
return known_languages[rand(0..4)]
end
@lonefreak
lonefreak / kitchen_centos
Created May 6, 2014 01:24
Chef + Knife Solo + Ruby 2.1.0 on CentOS
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y install gcc
yum -y install *gcc-c++*
@lonefreak
lonefreak / rbenv_install.sh
Last active December 31, 2015 23:19
Installing RBenv with ruby-build plugin
#!/bin/bash
####################################################################
# Script based on three references:
# https://github.com/sstephenson/rbenv
# https://github.com/sstephenson/ruby-build
# https://gist.github.com/jpfuentes2/2002954
####################################################################
# Run this script as a commom user (no need to 'sudo' it)
# However you will need to install these requirements before run this
<VirtualHost *:80>
ServerName local.busca.abril.com.br
ServerAlias local.busca.abril.com.br
DocumentRoot "/home/fabricio/workspace/abrilbusca"
Alias /libc/busca /home/fabricio/workspace/interface-bsc/libc/busca
<Directory /home/fabricio/workspace/abrilbusca>
Options +Includes +FollowSymLinks
AllowOverride All
@lonefreak
lonefreak / graphite-0.9.10-centos-6.2.sh
Created November 7, 2012 19:05
Install Graphite 0.9.10 on CentOS 6.2
#! /bin/sh
# GRAPHITE 0.9.10
# FOR CENTOS 6
# Andrew Diller Jan 2012
# Modified by Fabricio Leotti Nov 2012
# THIS SCRIPT DEPENDS ON PYTHON 2.6 (NO MORE, NO LESS)
# Get EPEL Repo installed
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
@lonefreak
lonefreak / cloud_stack_api.sh
Created November 6, 2012 19:27
Preparing curl request for CloudStack API
#!/bin/bash
#
# kick_api.sh
#
# please set your host
address="http://[your management server]:8080"
# please set your api key
api_key="QVOObVBiTodKl5L0vPQFCCELsxbtEHHysXU42XTFFwhBHWWFV7GaiH5oJG0yHHsqFzCcgflH8Ee8Ttk4m_qJLQ"
# please set your secret key
secret_key="zTl4qQtSZPijMkNYgkX1lQh6QlEUXyjSKeXSPZQl2MJifzOBFhNDA5cQlfK7Ds5BFEM_ua_5ELMPL-z4JNJBIA"