This file contains 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 | |
sleep 2m | |
iptables -F | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD ACCEPT |
This file contains 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 python | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummy-web-server.py [<port>] | |
Send a GET request:: | |
curl http://localhost |
This file contains 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
# author @modsaid | |
# Script to test action mailer configuration. to be run through the console, or rails runner | |
class MyMailer < ActionMailer::Base | |
default from: '[email protected]' | |
def test_email | |
mail(to: "[email protected]", | |
subject: 'SMTP configuraiton test', | |
body: 'bla bla bla') | |
end |
This file contains 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 | |
# This script uses ssconvert to convert all *.csv files in the current directory into *.xlsx format | |
command -v ssconvert >/dev/null 2>&1 || { echo >&2 "ssconvert is not installed, please install it via apt-get install gnumeric"; exit 1; } | |
find . -maxdepth 1 -name "*.csv" -exec ssconvert {} --export-type=Gnumeric_Excel:xlsx2 \; | |
This file contains 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 | |
# This script is made to rename default rotated access log files from access.log.1, access.log.2 and | |
# so on, to using timestamp instead of auto increment index (to be access.log.2014102009) | |
# | |
# USAGE: | |
# cd LOGS_DIR && ./access-logs-timestamp.sh | |
FILES=access.log* |
This file contains 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
Rails as it has never been before :) |
This file contains 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 'tempfile' | |
require 'fileutils' | |
COPYRIGHT=%Q( | |
## | |
# Author: AUTHOR NAME | |
# Copyright: Copy right message | |
# | |
) |
This file contains 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/local/bin/ruby | |
# A script to download the latest episodes from railscasts.com | |
# | |
# requires simple-rss (1.2.2) gem | |
# and base on linux wget | |
# | |
# author: modsaid < [email protected] > | |
# |
This file contains 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
#place this directly in the rails console of ur rails application | |
class UserMailer < ActionMailer::Base | |
default from: '[email protected]' | |
def test_email | |
@receiver_email = '[email protected]' | |
mail(to: @receiver_email, subject: 'testing email from console') | |
end | |
end |
This file contains 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
#To be placed in application_controller.rb | |
rescue_from Exception, :with => :rescue_all_exceptions unless %W(development test).include?(Rails.env) | |
def rescue_all_exceptions(exception) | |
buffer = "[EXCEPTION] " | |
buffer << exception.message << "\t(Request: #{request.url}\t Referrer: (#{request.env['HTTP_REFERER']} ) \n\t" | |
buffer << exception.backtrace.join("\n\t") | |
Rails.logger.error buffer |
NewerOlder