Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am michelemina on github.
  • I am michelemina (https://keybase.io/michelemina) on keybase.
  • I have a public key ASAdVun8dbQvBT67eDYhrxD_7h32qZi67_4EfUC6i79DEgo

To claim this, I am signing this object:

@michelemina
michelemina / memcached_telnet.rb
Created June 18, 2014 15:03
Memcached telnet client (forked from another gist)
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
servers = ["localhost"]
servers.each do |host|
p host
begin
server = Net::Telnet::new("Host" => host, "Port" => 11211, "Timeout" => 3)
slab_ids = []
@michelemina
michelemina / gist:10021370
Created April 7, 2014 14:30
ReadOnly ActiveRecord Model
module ActiveRecord
class Base
def readonly?
true
end
def destroy
raise "Are you Crazy?"
end
@michelemina
michelemina / deploy.rb
Last active January 17, 2017 12:18
oracle client capistrano install task: useful when ruby-oci8 is required in a server
...
set :default_environment, {
'LD_LIBRARY_PATH' => "#{shared_dir}/oracle/"
}
#!/bin/bash
echo "Mysql complete hot backup started"
DEST="/dest-path"
USERNAME="username"
PASSWORD="password"
databases=`mysql -u$USERNAME -p$PASSWORD -e "show databases;" | grep -v +----------------------+ | grep -v Database | grep -v information_schema`
INFO_SCHEMA="information_schema"
if [ ! -d $DEST ]; then
@michelemina
michelemina / create_postgresql_dumps
Created September 19, 2013 17:03
create dump foreach db on postgresql
#!/bin/bash
echo "Postgresql complete hot backup started"
DIR="/dump-path"
[ ! $DIR ] && mkdir -p $DIR || :
LIST=$(su postgres -c "psql -l" | awk '{ print $1}' | grep -vE '^-|^List|^Name|template[0|1]|^\(|^\||^$')
for d in $LIST
do
echo "Dump $d started"
su postgres -c "/usr/bin/pg_dump $d" | gzip -c > $DIR/$d.dump.gz
@michelemina
michelemina / .bashrc
Created August 8, 2012 09:06
Promt: debian git
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in