Skip to content

Instantly share code, notes, and snippets.

View yeban's full-sized avatar

Anurag Priyam yeban

View GitHub Profile
def on_success!(response, ax_response)
debugger
email=ax_response.data["http://schema.openid.net/contact/email"]
if user = find_user_by_email(email)
user
else
user=user_class.new({:email=>email})
user.save
user
end
def run!
if request.params[:'openid.mode']
response = consumer.complete(request.send(:query_params), "#{request.protocol}://#{request.host}" + request.path)
case response.status.to_s
when 'success'
ax_response = ::OpenID::AX::FetchResponse.from_success_response(response) #modified
result = on_success!(response, ax_response)
Merb.logger.info "\n\n#{result.inspect}\n\n"
result
when 'failure'
# yeban theme for SLiM
# by Anurag Priyam
# Messages (ie: shutdown)
msg_color #FFFFFF
msg_font Monaco:size=18:bold:dpi=75
msg_x 50%
msg_y 40%
msg_shadow_color #702342
msg_shadow_xoffset 1
IplImage* dilate( const IplImage* src, const IplImage* kernel){
//create a destination image with the same parametrs as the source image
IplImage* dst = cvCreateImage(cvSize(src->height, src->width), IPL_DEPTH_8U, 1);
vector<uchar> pix_values; //to store all the pixels that are covered
int i, j;
//loop over each row
for( int row = 0; row < src->height; row++ ){
@yeban
yeban / xmonad.hs
Created February 22, 2010 11:39
xmonad.hs used to run xmonad with Xfce4
--
-- xmonad example config file.
--
-- A template showing all available configuration hooks,
-- and how to override the defaults in your own xmonad.hs conf file.
--
-- Normally, you'd only override those defaults you care about.
--
import XMonad
@yeban
yeban / xmonad.diff
Created February 22, 2010 11:46
A diff of my xmonad.hs with the default one
15a16,21
> import XMonad.Hooks.ManageDocks
> import XMonad.Hooks.EwmhDesktops
>
> import XMonad.Layout.Maximize
>
>
19c25
< myTerminal = "xterm"
---
@yeban
yeban / readline.c
Created March 2, 2010 16:42
A c function to take a string input of arbitrary length.
//the return pointer must be freed
char* readline() {
char buffer;
char *command = NULL;
char *tmp = NULL;
int size = 0;
int last = 0;
while ( 1 ){ //listen indefinitely for characters
/*
* =====================================================================================
*
* Filename: threads.c
*
* Description: Familiarising with pthreads.
*
* Version: 1.0
* Created: Thursday 11 March 2010 01:25:12 IST
* Revision: none
@yeban
yeban / gmail.rb
Created April 11, 2010 16:05
Bare bones Ruby script to send emails using Gmail
=begin
Tested with ruby 1.8.7 on a Debian machine, with my own gmail account.
ruby -rubygems "from name" "from email" "to name" "to email" "subject" "body"
=end
require 'net/smtp'
require 'tlsmail'
Net::SMTP.enable_tls OpenSSL::SSL::VERIFY_NONE
$SERVER = 'smtp.gmail.com'
@yeban
yeban / fonts.conf
Created May 16, 2010 16:47
.fonts.conf file for rendering fonts beautifully (like Ubuntu). Tested on a Debian box.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="autohint" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="rgba" >