Skip to content

Instantly share code, notes, and snippets.

View ivanionut's full-sized avatar
🎯
Focusing

Ivan Ionut ivanionut

🎯
Focusing
View GitHub Profile
<!---
Function Name : numberToLetter()
Author : Ryan Spencer
Created : 22/05/2012
General Notes : convert a number into a letter similar to how excell columns work.
Function in :
number (int)
<!-- CODE
NAME
DESC
STATUS
MERGED
MAIN CATEGORY
SPACER
SUB CATEGORY
SPACER
SUB CATEGORY 3
<cfcomponent name="PostMarkAPI" hint="Send email messages using Postmarkapp.com API">
<cffunction name="sendMail" output="false" access="remote" returntype="struct" returnformat="json" description="Assembles JSON packet and sends it to Postmarkapp">
<cfargument name="mailTo" required="true" type="string" displayname="Recipient" />
<cfargument name="mailFrom" required="true" type="string" displayname="Sender" default="xxx@xxx.com" />
<cfargument name="mailSubject" required="true" type="string" displayname="Subject" default="Testing Postmark" />
<cfargument name="apiKey" required="true" type="string" displayname="API key" default="xxx-xxx-xxx-xxx" />
<!--- optional --->
<cfargument name="mailReply" required="false" type="string" displayname="Reply-To (optional)" />
<cfargument name="mailCc" required="false" type="string" displayname="CC (optional)" />
<cfargument name="mailHTML" required="false" type="string" displayname="HTML body (optional)" />
<!--------------------------------------
Credit for the upload part (with some changes):
http://www.anujgakhar.com/2011/11/29/directly-uploading-a-file-to-amazon-s3-with-railo/
Performance improvements:
- store file initially in virtual disk first (ram://), do resize then write to s3
- define s3 path as railo mapping
- set region to correct region (defaults to us i believe)
---------------------------------------->
<cfcomponent>
<cffunction name="csvToQuery">
<cfargument name="data" default="">
<cfargument name="cols" default="">
<cfargument name="delimiter" default=",">
<cfscript>
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
REReplace( "your-string" , "\b(\S)(\S*)\b" , "\u\1\L\2" , "all" )
abaco
abbondanza
abbondanzia
abbondanzio
abbondazio
abbondia
abbondina
abbondio
abdenago
abdon
<!---
Parts of this are based on Tim Dawe's
http://amazonsig.riaforge.org
and
Joe Danziger's Amazon S3 REST Wrapper
http://amazons3.riaforge.org/
Written by Patrick Liess

Nginx Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2xIntel Xeon with HT enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

First, you will need to install nginx, my way to install nginx is compiling it from source, but for now we will use apt-get