Skip to content

Instantly share code, notes, and snippets.

View kpx-dev's full-sized avatar
🔥
FIRE!

Kien Pham kpx-dev

🔥
FIRE!
View GitHub Profile
@kpx-dev
kpx-dev / gist:2381189
Created April 14, 2012 00:35
Solution to: Problem A. Speaking in Tongues
<?php
/**
* Google Code Jam 2012
*
* @author Kien Pham - kien@sendgrid.com
*/
$C = new CodeJam();
$C->run();
@kpx-dev
kpx-dev / gist:2382126
Created April 14, 2012 04:23
Problem B. Dancing With the Googlers
<?php
/**
* Google Code Jam 2012
*
* @author Kien Pham - kien@sendgrid.com
*/
$C = new CodeJam();
$C->run();
@kpx-dev
kpx-dev / gist:2386118
Created April 14, 2012 17:31
Solution to: Problem C. Recycled Numbers
<?php
/**
* Google Code Jam 2012
*
* @author Kien Pham - kien@sendgrid.com
*/
$C = new CodeJam();
$C->run();
@kpx-dev
kpx-dev / configure.sh
Created August 9, 2012 20:19
Configure parameters for PHP 5.4 on Lion mac os x
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
@kpx-dev
kpx-dev / gunicorn
Created October 15, 2013 06:08 — forked from xspager/gunicorn
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn server
# Description: starts gunicorn using start-stop-daemon
import base64
import hashlib
import random
# generate random string length of 43
base64.b64encode(hashlib.sha256( str(random.getrandbits(256)) ).digest(), random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])).rstrip('==')
@kpx-dev
kpx-dev / sendgrid_block.py
Created November 20, 2014 19:55
SendGrid block example with requests library
"""
This Python code snippet will show you how to get all SendGrid block records
Please change SG_USERNAME and SG_PASSWORD to match your credentials
install the amazing requests library
$ pip install requests==2.4.3
save this file as python block.py and run it
$ python block.py
"""
@kpx-dev
kpx-dev / bounces.py
Created November 20, 2014 20:11
SendGrid bounces example
"""
This Python code snippet will show you how to get all SendGrid bounces
records.
install the amazing requests library
$ pip install requests==2.4.3
export your SendGrid credential from command line
$ export SG_USERNAME=your_sg_username
$ export SG_PASSWORD=your_sg_password
@kpx-dev
kpx-dev / filter_commands.py
Created November 21, 2014 04:10
SendGrid filters commands
"""
This Python code snippet will show you how to get work with SendGrid filter
commands
install the amazing requests library
$ pip install requests==2.4.3
export your SendGrid credential from command line
$ export SG_USERNAME=your_sg_username
$ export SG_PASSWORD=your_sg_password
"""
This Python code snippet will show you how to get work with SendGrid filter
settings
install the amazing requests library
$ pip install requests==2.4.3
export your SendGrid credential from command line
$ export SG_USERNAME=your_sg_username
$ export SG_PASSWORD=your_sg_password