Skip to content

Instantly share code, notes, and snippets.

View guipdutra's full-sized avatar

Guilherme Dutra guipdutra

View GitHub Profile
@skwp
skwp / dynamic_method_spec.rb
Created December 7, 2013 00:44
Fail your build for user-defined style rules.
require 'spec/support/grep_matcher'
describe do
disallow_presence_of pattern: "send(.*#",
location: "app/",
description: "Do not use dynamic method invocations",
failure: "Please change dynamic method call to something more sane."
end
@jamesejr
jamesejr / ms12-020.py
Created August 24, 2013 23:13
MS12-020 Remote Desktop Protocol (RDP) Remote Code Execution PoC (Python)
#
#
# ms12-020 "chinese shit" PoC v2 (wireshark version)
#
# tested on winsp3 spanish, reported to work on Win7, win 2008
#
# original source: http://115.com/file/be27pff7
#
#
@vparihar01
vparihar01 / user_mailer.rb
Last active June 7, 2019 09:27
Just copy the user_mailers inside your Mailers directory and then inside user_mailers views move welcome_email_to_player.html.haml. Then user UserMailer.welcome_email_to_player.deliver. tada.... Your mail is sent. For out just check this test yomail account => [email protected].
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def welcome_email_to_player
attachments.inline['user_back'] = {
:data => File.read("#{Rails.root.to_s + '/app/assets/images/bg.jpg'}"),
:mime_type => "image/jpg",
:encoding => "base64"
}
mail(:to => "[email protected]", :subject => "Welcome to here")
end
@Odaeus
Odaeus / application_controller.rb
Last active February 12, 2025 06:24
Alternative to Rails' sharing of instance variables between controller and views.
class ApplicationController < ActionController::Base
# Creates an accessor which is exposed to the view
def self.view_accessor(*names)
attr_accessor *names
helper_method *names
end
end

Using vagrant

Install

  • Install VirtualBox
  • Install vagrant (use the OS installer instead of gem)

Setup

  • vagrant box add <box_name> <box_url>
@omnisis
omnisis / H2EmbeddedTest.java
Last active February 29, 2020 14:16
Configuring H2 database for unit tests w/ spring
package examples.database;
import com.google.common.collect.Lists;
import examples.database.dao.PeopleDAO;
import examples.database.model.PeopleInfo;
import org.apache.commons.lang.time.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
@postmodern
postmodern / rails_rce.rb
Last active March 5, 2025 00:46
Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@obscurerichard
obscurerichard / README.md
Created September 17, 2012 22:35
Simulates a low bandwidth, high-latency network connection

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default

slow modem-56k -d eth0 # Simulate a 56k modem on the eth1 device. eth0 is unchanged.

@lucasdavila
lucasdavila / dynamic_form_for_hstore_attributes_in_rails.html.erb
Created September 13, 2012 15:54
Dynamic form for hstore attributes in rails
<%= simple_form_for @product do |f| %>
<%= f.simple_fields_for :attributes do |d| %>
<% f.object.attributes.try(:each) do |key, value| %>
<%= d.input key, :input_html => {:value => value } %>
<% end %>
<% end %>
<% end %>

Pão de queijo do Felix

  • 3 xícaras de polvilho (preferencia azedo, mas pode ser o doce)

  • 3 ovos

  • 100g de queijo ( ou a vontade)

  • 1 copo de leite