Skip to content

Instantly share code, notes, and snippets.

View ychaouche's full-sized avatar

Yassine Chaouche ychaouche

View GitHub Profile
@ychaouche
ychaouche / gist:4118137
Created November 20, 2012 14:06
search a contact with by email address in sugarcrm
SELECT contacts.first_name, contacts.last_name
FROM
contacts
WHERE contacts.id
IN
(
SELECT email_addr_bean_rel.bean_id
FROM email_addr_bean_rel
JOIN email_addresses
ON email_addr_bean_rel.email_address_id = email_addresses.id
=SOMMEPROD(Total!D:D="Bug";Total!E:E="Haute") + SOMMEPROD(Total!D:D="A Faire";Total!E:E="Haute")
=SOMMEPROD(N(Total!D:D="Bug");N(Total!E:E="Basse"))
=SUMPRODUCT(($Total.D$1:D$1048576="Bug")*($Total.E$1:E$1048576="Basse"))
=SOMMEPROD((Total!D:D="Bug")*(Total!E:E="Basse"))+SOMMEPROD((Total!D:D="A faire")*(Total!E:E="Basse"))
@ychaouche
ychaouche / gist:4148399
Created November 26, 2012 14:10
phpmyadmin.conf
<VirtualHost *:80>
ServerName phpmyadmin.localhost
ServerAlias phpmyadmin
DocumentRoot "/srv/www/htdocs/phpMyAdmin"
ErrorLog /var/log/apache2/errors/phpmyadmin.log
CustomLog /var/log/apache2/access/phpmyadmin.log combined
<Directory /srv/www/htdocs/phpMyAdmin>
Options FollowSymLinks
AllowOverride None
<IfModule mod_php5.c>
@ychaouche
ychaouche / gist:4148401
Created November 26, 2012 14:10
dokuwiki.conf
#
# VirtualHost template
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf.
# Files must have the .conf suffix to be loaded.
#
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.
#
# NameVirtualHost statements can be added to /etc/apache2/listen.conf.
#
@ychaouche
ychaouche / gist:4188671
Created December 2, 2012 13:29
geomtery.py
class Line :
def __init__(self,point = None,vector = None,A = None,B = None) :
""" Parametric equations are fine """
if not A == None and not B == None :
self.vector = Vector(point = B-A)
## self.vector.normalize()
self.point = A
elif not point == None and not vector == None :
SugarProxy.prototype.create_appt_request = function(appt_details,batch){
var component = {
status : "CONF",
fb : "B",
/* YUI refuses to compile this. We'll add it later */
/* class : "PUB",*/
allDay : 0,
draft : 1,
transp : 0,
@ychaouche
ychaouche / lottery.py
Last active December 19, 2015 22:39
lottery.py, a game of lottery proposed on reddit.
"Versin 2 ? "
import random
def welcome_msg():
print 'Welcome to the Python lottery! Here are the rules'
print 'Specify the amount of numbers you want in the lottery...'
print 'Place your bet!'
print 'For each number guessed correctly, regardless of position'
print 'you win %50 of your bet...'