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
sudo yum install -y systemtap systemtap-runtime | |
sudo yum install kernel-debuginfo kernel-debuginfo-common | |
sudo yum install yum-utils | |
debuginfo-install kernel-3.10.0-514.21.2.el7.x86_64 | |
sudo yum install -y kernel-devel-$(uname -r) | |
sudo yum install -y kernel-debuginfo-$(uname -r) | |
sudo yum install -y kernel-debuginfo-common-$(uname -m)-$(uname -r) |
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
# A functional FizzBuzz (without any integer modulus or division) in Elixir | |
# https://pragprog.com/magazines/2012-08/thinking-functionally-with-haskell | |
nums = Stream.iterate(1, &(&1 + 1)) | |
fizz = Stream.cycle ["", "", "Fizz"] | |
buzz = Stream.cycle ["", "", "", "", "Buzz"] | |
fizzbuzz = Stream.zip(fizz, buzz) |> Stream.zip(nums) |> Stream.map(fn | |
{{"", "" }, number} -> number | |
{{fizzword, buzzword}, _number} -> fizzword <> buzzword | |
end) | |
fizzbuzz |> Stream.take(100) |> Enum.each(&IO.puts/1) |
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
from functools import wraps | |
from timeit import default_timer | |
import gevent | |
from gevent.queue import Queue | |
def gevent_throttle(calls_per_sec=0): | |
"""Decorates a Greenlet function for throttling.""" | |
interval = 1. / calls_per_sec if calls_per_sec else 0 | |
def decorate(func): | |
blocked = [False] # has to be a list to not get localised inside the while loop |