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
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
# author @modsaid | |
# Script to test action mailer configuration. to be run through the console, or rails runner | |
class MyMailer < ActionMailer::Base | |
default from: 'notifications@example.com' | |
def test_email | |
mail(to: "mail@exmaple.com", | |
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
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
#!/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 < mahmoud@modsaid.com > | |
# |
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: 'sender@espace.com.eg' | |
def test_email | |
@receiver_email = 'mahmoud.said@espace.com.eg' | |
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 |
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
# Sometimes, specially if we are building a monitoring system or an admin UI, | |
# we need to be able to easily check if a process is running. | |
# Unfortunately this is not directly available through Process module. so here is a patch to add it | |
# | |
# Usage: | |
# Process.running?(pid) | |
# Process.memory(pid) # returns the memory usage in KB | |
module Process |
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
git archive master | tar -x -C /somewhere/else | |
OR | |
git archive --format zip --output /full/path/to/zipfile.zip master | |
Ref: http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export |
NewerOlder