This file contains hidden or 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
// 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"]
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
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(); | |
} | |
} |
This file contains hidden or 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 Ability | |
Error = Class.new(StandardError) | |
AccessDenied = Class.new(Error) | |
NotImplemented = Class.new(Error) | |
def initialize(user) | |
@user = user | |
end | |
def ensure_can(action, subject) |
This file contains hidden or 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 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) |
This file contains hidden or 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
{ | |
"directory": "vendor/assets/components" | |
} |
This file contains hidden or 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
NewerOlder