This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'logger' | |
require 'rest_client' | |
$stdout.sync = true | |
$stdin.sync = true | |
path = "/var/log/ejabberd/auth.log" | |
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#drop all indexes in current db that are not primary keys | |
select distinct concat('drop index ', index_name, ' ON ', table_name, ';') | |
from information_schema.statistics | |
where table_schema=DATABASE() | |
and index_name != 'PRIMARY' | |
and column_name like '%_id'; | |
#create indexes | |
select concat('create index idx_',column_name, ' on ', table_name,'(',column_name,');') | |
from information_schema.columns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'logger' | |
require 'rest_client' | |
$stdout.sync = true | |
$stdin.sync = true | |
path = "/usr/local/var/log/ejabberd/auth.log" | |
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mygrants() | |
{ | |
mysql -B -N $@ -e "SELECT DISTINCT CONCAT( | |
'SHOW GRANTS FOR ''', user, '''@''', host, ''';' | |
) AS query FROM mysql.user" | \ | |
mysql $@ | \ | |
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Based on http://railsapps.github.com/installing-rails-3-1.html | |
cd ~ | |
sudo apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev curl git-core | |
bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm) | |
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sqlite3' | |
require 'rexml/document' | |
include REXML | |
xml =<<XML | |
<records> | |
<entry><name>abc</name><qty>3</qty></entry> | |
<entry><name>def</name><qty>5</qty></entry> | |
<entry><name>ghi</name><qty>2</qty></entry> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
#install lot-o-junk | |
sudo apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf subversion | |
#git rvm | |
curl -L https://get.rvm.io | bash -s stable --ruby | |
#load rvm | |
source ~/.rvm/scripts/rvm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#simple adobe policy file checker. | |
require 'socket' | |
class PolicyFileServerTester | |
def self.send_request(ip, port=843, query="<policy-file-request/>\000") | |
myserver = TCPSocket.open(ip, port) | |
myserver.send(query, 0) | |
a = myserver.recv(1000) | |
myserver.close |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I wanted to do stuff like myserver.plugins.overview.cpu_last_minute this lets me do that. | |
#Haven't tested the refresh to make sure it works. | |
#Example | |
# @server = ScoutServer.new("MyServer") | |
# puts @server.plugins.overview.disk_capacity | |
# puts @server.plugins.overview.mem_used | |
# puts @server.plugins.overview.cpu_last_five_minutes | |
require 'scout_scout' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to increase file handles on ubuntu | |
/etc/security/limits.conf | |
* soft nofile 65536 | |
* hard nofile 65536 | |
#notice bottom line |
NewerOlder