- Read every row in the table
- No reading of index. Reading from indexes is also expensive.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'celluloid' | |
require 'open-uri' | |
require 'cgi' | |
require 'benchmark' | |
module Enumerable | |
def pmap(&block) | |
futures = map { |elem| Celluloid::Future(elem, &block) } | |
futures.map { |future| future.value } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Respond extends Service[Request, Response] with Logger { | |
def apply(request: Request) = { | |
try { | |
request.method -> Path(request.path) match { | |
case GET -> Root / "todos" => Future.value { | |
val data = Todos.allAsJson | |
debug("data: %s" format data) | |
Responses.json(data, acceptsGzip(request)) | |
} | |
case GET -> Root / "todos" / id => Future.value { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
organization := "net.seratch" | |
name := "sandbox" | |
version := "0.1" | |
scalaVersion := "2.9.1" | |
libraryDependencies ++= Seq( | |
"junit" % "junit" % "4.9" withSources(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Munin Passenger Plug-in Installation | |
Configure the passenger plug-ins according the the guide on http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/ | |
NOTE: restart munin after implementing the following changes for Single-User RVM | |
sudo nano /etc/munin/plugin-conf.d/munin-node | |
[passenger_*] | |
user root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.tototoshi.finagle_hack | |
import java.net.InetSocketAddress | |
import com.twitter.finagle.{Service, SimpleFilter} | |
import com.twitter.util.Future | |
import com.twitter.finagle.builder.{Server, ServerBuilder} | |
import com.twitter.finagle.http._ | |
import com.twitter.finagle.http.path._ | |
object HTTPServer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// #include <stdlib.h> | |
// #include "wrapper.c" | |
import "C" | |
import "unsafe" | |
import "fmt" | |
func read(filename string) string { | |
f := C.CString(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
OlderNewer