Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathieu Leduc-Hamel mlhamel

View GitHub Profile
View gist:2697771
ContactSchema.pre('save', function(next) {
var self = this;
Step(
function count() {
Message
.find({author: self.user, recipient: self.contact})
.count(this.parallel());
Message
.find({author: self.contact, recipient: self.user})
.count(this.parallel());
@mlhamel
mlhamel / gist:2726808
Created May 18, 2012
nodejs buildout config
View gist:2726808
[buildout]
parts = nodejs nodejs-bin
versions = versions
[versions]
mongodb = 1.8.1
[nodejs]
recipe = zc.recipe.cmmi
url = http://nodejs.org/dist/v0.6.16/node-v0.6.16.tar.gz
View gist:2869742
req.family.admins.forEach(function(admin) {
req.family.admins.remove(admin);
});
req.family.members.filter(function(member) {
return member.parent;
}).forEach(function(member) {
req.family.addAdmin(member);
});
req.family.save(function(err) {
if(err) {
View gist:6159566
(setq backup-directory-alist
`((".*" . ,(file-name-directory (or load-file-name buffer-file-name)))))
(setq auto-save-file-name-transforms
`((".*" ,(file-name-directory (or load-file-name buffer-file-name)) t)))
View heartbleed.py
#!/usr/bin/python
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
#
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)
@mlhamel
mlhamel / gist:83c28fa90afcbe96b673
Last active Aug 29, 2015
Montreal-Python + pythondotorg: interesting tickets
View gist:83c28fa90afcbe96b673
Pythondotorg at Montreal-Python Project Night
=============================================
The idea is to work on a Django project and to help the Python community by
making the Python website better.
For Installation instructions, please have a look at the following document:
http://htmlpreview.github.io/?https://github.com/mtlpy/pythondotorgdocs/blob/master/build/html/index.html
View fax.py
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
account_sid = ''
auth_token = ''
client = Client(account_sid, auth_token)
fax = client.fax.faxes \
View gist:599b8591e918e46facc9a1aedfdbe495
<!DOCTYPE html>
<html style='height: 100% !important; width: 100% !important; font-family: var(--body_font-family), -apple-system, BlinkMacSystemFont, "San Francisco", Roboto, "Segoe UI", "Helvetica Neue", sans-serif; font-weight: var(--body_font-weight); font-style: var(--body_font-style); line-height: 1.5em; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; margin: 0 auto; padding: 0;'>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="format-detection" content="address=no">
<title></title>