Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / mysql_db_size.sql
Created May 2, 2012 13:03
Check mysql databases size
SELECT
table_schema "Data Base Name",
sum(data_length + index_length) / 1024 / 1024 "Data Base Size in MB",
sum(data_free) / 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
@skarllot
skarllot / bashrc.sh
Last active November 29, 2024 17:56
Default Bash prompt (bashrc PS1)
# Each distribution default Bash prompts
# Gentoo (/etc/bash/bashrc)
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
@skarllot
skarllot / redmine.conf
Created May 10, 2012 16:44
Run Redmine on sub URI
# Redmine sub URI configuration
#
# CentOS: /etc/httpd/conf.d/redmine.conf
# Debian: /etc/apache2/conf.d/redmine.conf
# Gentoo: /etc/apache2/vhosts.d/(?)redmine_vhost.conf
Alias /redmine /var/www/redmine/public
<Location /redmine>
SetEnv RAILS_RELATIVE_URL_ROOT "/redmine"
@skarllot
skarllot / config
Created May 15, 2012 18:58
Local SSH config examples
# ~/.ssh/config
# git clone server01:repo_name
Host server01
User git
Hostname 192.168.0.1
Port 2222
PreferredAuthentications publickey
IdentityFile /media/flash8gb/ssh/id_rsa
@skarllot
skarllot / app.conf
Created June 27, 2012 16:19
PHP directory restriction
#. . .
<Directory /docroot>
php_admin_value open_basedir /docroot
</Directory>
#. . .
@skarllot
skarllot / php.ini
Created June 27, 2012 16:23
PHP functions restriction
;. . .
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
;. . .
@skarllot
skarllot / crypttab
Created July 28, 2012 15:17
Encrypted (LUKS) home partition
# /etc/crypttab
home1 /dev/sdX none luks,tries=3
home2 /dev/mapper/vg_main-lv_home none luks,tries=3
@skarllot
skarllot / krb5.conf
Created August 27, 2012 13:48
Samba client
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = SKARLLOT.COM
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
@skarllot
skarllot / list-gentoo-packages.sh
Created October 17, 2012 19:57
List all installed Gentoo packages with USE flags.
#!/bin/bash
#
# list-gentoo-packages.sh v0.2
# Copyright 2007-2009, Nikita Melnichenko [http://nikita.melnichenko.name]
# License: GPL-2 (http://opensource.org/licenses/gpl-license.php)
#
# List all installed Gentoo packages with USE flags.
# generate use flags for package $1 (official, but very slow)
function portage_gen_use_flags_by_equery ()
@skarllot
skarllot / optionize.sh
Created November 7, 2012 13:23
Handling parameters into bash scripts
#!/bin/bash
#
# Copyright (C) 2007 kace
# http://bsdpants.blogspot.de/2007/02/option-ize-your-shell-scripts.html
readonly USAGE='usage: '`basename $0`' [-13ds] [-o out-file] filename'
snmpver=2c
sync=0
debug=0