Skip to content

Instantly share code, notes, and snippets.

View breim's full-sized avatar
:shipit:

Henrique Breim breim

:shipit:
View GitHub Profile
@denji
denji / nginx-tuning.md
Last active April 28, 2025 03:46
NGINX tuning for best performance

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 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading 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.

@bennadel
bennadel / multiple-dropzones.htm
Created December 15, 2013 01:44
Using Multiple Dropzones And File Inputs With A Single Plupload Instance
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
Using Multiple Dropzones With A Single Plupload Instance
</title>
<link rel="stylesheet" type="text/css" href="./assets/css/styles.css"></link>
@rxaviers
rxaviers / gist:7360908
Last active April 28, 2025 14:05
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@esbanarango
esbanarango / gist:6629748
Last active May 8, 2018 18:12
HTML <input> required attribute and Rails form with remote true.

<input> with attribute required

This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.

How to show a spinner only when the required validations pass? (Without using any validation plugin, only the required attribute).

Form with a required input

= form_for @person, remote: true do |f|
 = f.text_field, :first_name, required: true
@j3tm0t0
j3tm0t0 / gist:6496327
Last active April 16, 2017 00:23
ec2 run instance with public ip in vpc
[1] pry(main)> require 'aws-sdk'
=> true
[2] pry(main)> ec2 = AWS.ec2
=> <AWS::EC2>
[3] pry(main)> ec2.client.run_instances(:image_id => 'ami-39b23d38' , :network_interfaces => [{:device_index => 0 , :subnet_id => 'subnet-6fa0f706', :associate_public_ip_address => true }], :min_count => 1, :max_count => 1 );
[4] pry(main)> ec2.instances.create(:image_id => 'ami-39b23d38' , :network_interfaces => [{:device_index => 0 , :subnet_id => 'subnet-6fa0f706', :associate_public_ip_address => true }]);
@blaix
blaix / service-objects.md
Created June 12, 2013 11:04
Martin Fowler on Service Objects via the Ruby Rogues Parley mailing list

On Tue, Mar 12, 2013 at 1:26 PM, Martin Fowler [email protected] wrote:

The term pops up in some different places, so it's hard to know what it means without some context. In PoEAA I use the pattern Service Layer to represent a domain-oriented layer of behaviors that provide an API for the domain layer. This may or may not sit on top of a Domain Model. In DDD Eric Evans uses the term Service Object to refer to objects that represent processes (as opposed to Entities and Values). DDD Service Objects are often useful to factor out behavior that would otherwise bloat Entities, it's also a useful step to patterns like Strategy and Command.

It sounds like the DDD sense is the sense I'm encountering most often. I really need to read that book.

The conceptual problem I run into in a lot of codebases is that rather than representing a process, the "service objects" represent "a thing that does the process". Which sounds like a nitpicky difference, but it seems to have a real impact on how people us

@ryane
ryane / ci_install.sh
Created April 17, 2013 19:38
A script (or just list of commands) to setup a jenkins server on Ubuntu 12.04 hosted at linode. Liberally borrowed from https://gist.github.com/whistler/3179919#file-jenkins_rails_ubuntu-sh
sudo aptitude -y install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev
sudo apt-get -y install libxslt-dev libxml2-dev
sudo apt-get -y install libmysqlclient-dev ruby-dev
sudo apt-get -y install libcurl4-openssl-dev
sudo apt-get -y install imagemagick libmagickcore-dev libmagickwand-dev
sudo apt-get -y install libsqlite3-dev
sudo apt-get -y install libreadline-dev
sudo apt-get -y install git
sudo apt-get -y install libicu48
sudo apt-get -y install nodejs
@okochang
okochang / introduction_ec2.rb
Created February 22, 2013 16:50
AWS SDK for Rubyを使ってEC2を起動して削除するまでの流れ
# -*- coding: utf-8 -*-
## EC2インスタスを起動するまでの流れで、スクリプトではないので注意して下さい
require 'aws-sdk'
ACCESS_KEY = 'set your access key id'
SECRET_KEY = 'set your secret key'
EC2_REGION = 'ec2.ap-southeast-1.amazonaws.com'
ec2 = AWS::EC2.new(
:access_key_id => ACCESS_KEY,
:secret_access_key => SECRET_KEY,
@nfo
nfo / README.md
Created September 10, 2012 15:54
A microgem to query the Amazon Web Services (S3/EC2/etc) usage reports.
@alphazo
alphazo / gist:3303282
Created August 9, 2012 11:03
Clone MiFare cards using chinesse UUID writable cards

libnfc supports UUID writable cards and even has some dedicated tools for them.

However it doesn't work with some of the cards found on eBay that are even simpler to use. Sector 0 is unlocked and can be written without any additional commands. libnfc requires a small patch to get it working.

Following has been tested under ArchLinux with modified libnfc 1.5.1, mfoc 0.10.2 and a SCL3711 dongle.

Patch & recompile libnfc

The patch is fairly simple, open libnfc-1.5.1/utils/nfc-mfclassic.c and comment 2 lines (it was lines 384 and 385 for me):

// Try to write the trailer