-
Use official CentOS 6 AMI, for details check the wiki
-
Enable SELinux, Check this tutorial of Red Hat to do it.
-
Create a security group for both Broker and Node with the ports 22, 80, 443 open
-- a quick LUA access script for nginx to check IP addresses against an | |
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403. | |
-- | |
-- allows for a common blacklist to be shared between a bunch of nginx | |
-- web servers using a remote redis instance. lookups are cached for a | |
-- configurable period of time. | |
-- | |
-- block an ip: | |
-- redis-cli SADD ip_blacklist 10.1.1.1 | |
-- remove an ip: |
defmodule ApplicationRouter do | |
use Dynamo.Router | |
prepare do | |
# Pick which parts of the request you want to fetch | |
# You can comment the line below if you don't need | |
# any of them or move them to a forwarded router | |
conn.fetch([:cookies, :params]) | |
end |
06/09/2010
Last time I studied the ability to embed javascript in nginx using the library Google V8 Javascript Engine , it should be noted, was no easy task, as all that complicated the classic "Hello World!", reflected in the documentation is extremely sketchy. Because V8 developed primarily for Chrome, then this left a significant imprint on him and, to paraphrase Henry Ford's statement about the color of the machine, it can be said that the V8 will work well in any application, provided that this program is called Chrome.
First of all, V8 does not know how to handle memory allocation errors - it just ends the process. This is acceptable for such a browser like Chrome, which displays each page in a separate process, and the crash of one process does not affect the other pages, but for the server to process in one process thousands of simultaneous connections, it does not fit. While V8 allows you to set your own error handler memory allocation, ho
#/usr/bin/env ruby | |
# A brute-force letterpress board searcher. It takes about 90 seconds to search a board. | |
# | |
# Good uses: train on your vocabulary with boards you lost on. | |
# | |
# LAZY AND STUPID CHEATERS: DO NOT USE THIS FOR CHEATING. CHEATERS NEVER WIN. | |
class BoardSearcher | |
attr_reader :board |
# Change the path to match the path to your machine. | |
$mrb_path = File.expand_path("~/src/mruby") | |
$mrbc = File.join($mrb_path,"/bin/mrbc") | |
task :default do | |
# dumps the Ruby file to disk | |
File.open("mandelbrot.rb", "w"){|f| f << mandelbrot_ruby_code } | |
# creates the .c file containing mandelbrot char array for the bytecode | |
`#{$mrbc} -Bmandelbrot_bytecode ./mandelbrot.rb` | |
example_file = wrapper_code(File.read("./mandelbrot.c")) |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
static NSString *CellIdentifier = @"patientCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell==nil) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; | |
NSString* letter = [[self sectionsTitlesArray] objectAtIndex:indexPath.section]; | |
NSString* filterString = [NSString stringWithFormat:@"last_name beginswith[cd] '%@'", letter]; | |
NSArray* filteredPatients = [GeneralFunctions filterArrayWithString:filterString objectsToFilter:patients]; | |
cell.textLabel.text = [(Patient *)[filteredPatients objectAtIndex:indexPath.row] fullName]; |
{"UIDeviceFamily":[1,2]} |
# Convert any YouTube video into an audio file you can listen to on the go, using: | |
# http://rg3.github.com/youtube-dl/ | |
{ ~ } > brew install ffmpeg | |
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl | |
{ ~ } > chmod u+x youtube-dl | |
# Pick which video format you want to download.. (use any YT video link) | |
{ ~ } > ./youtube-dl -s -F http://www.youtube.com/watch?v=vT1KmTQ-1Os |