// Example Program for MightyOhm Geiger Counter FeatherWing + OLED Upgrade | |
// This example is specifically for use with Adafruit Feather HUZZAH (ESP8266) | |
// It will also work with other Feather boards with modifications | |
// | |
// By: Dan Watson | |
// syncchannel.blogspot.com | |
// 1/31/2016 | |
// This program makes use of the EspSoftSerial library to receive data from the Geiger counter. | |
// EspSoftwareSerial: https://github.com/scottwday/EspSoftSerial |
My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.
As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.
I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.
So, in order to profile your worker, add this to your Sidekiq configuration:
if ENV["PROFILE"]
#!/bin/sh | |
# Usernames who will be using the Dropbox service | |
DROPBOX_USERS="username" | |
DAEMON=.dropbox-dist/dropboxd | |
start() { | |
echo "Starting dropbox..." | |
for dbuser in $DROPBOX_USERS; do |
import java.util.Set; | |
import java.util.concurrent.ConcurrentHashMap; | |
public class HelloCovariance { | |
public static void main(String[] args) { | |
ConcurrentHashMap<String, String> properties = new ConcurrentHashMap<>(); | |
Set<String> keySet = properties.keySet(); | |
} | |
} |
class Ability | |
Error = Class.new(StandardError) | |
AccessDenied = Class.new(Error) | |
NotImplemented = Class.new(Error) | |
def initialize(user) | |
@user = user | |
end | |
def ensure_can(action, subject) |
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
- Go HTTP standalone (as the control group)
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
class Enumerator | |
def extract(&blk) | |
self.each do |obj| | |
blk.call(*blk.parameters.map(&:last).map {|attr| obj.send(attr)}) | |
end | |
end | |
end | |
Treasure = Struct.new(:coins, :gems) |
{ | |
"directory": "vendor/assets/components" | |
} |