Deadlock detected,
The system is infected.
Zombie processes
Haunt orphaned guests.
Abort transactions,
While we break the loop.
Don’t crash the node,
It’s a dependency soup.
Deadlock detected,
The system is infected.
Zombie processes
Haunt orphaned guests.
Abort transactions,
While we break the loop.
Don’t crash the node,
It’s a dependency soup.
| # List Comprehensions | |
| squares = [x**2 for x in range(10)] | |
| even_squares = [x**2 for x in range(10) if x % 2 == 0] | |
| # Dictionary Comprehensions | |
| squared_dict = {x: x**2 for x in range(10)} | |
| # Lambda Functions | |
| add = lambda a, b: a + b |
| MIT License | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all |
A company is planning a way to reward customers for inviting their friends.
They're planning a reward system that will give a customer points for each confirmed invitation they played a part into.
The definition of a confirmed invitation is one where another invitation's invitee invited someone.
The inviter gets (1/2)^k points for each confirmed invitation, where k is the level of the invitation:
| defmodule Downloader do | |
| @moduledoc""" | |
| Download streams of bytes from URLs. | |
| Useful to transfer large files with low RAM usage. | |
| ## Example with `ExAWS.S3.upload/3` | |
| ```elixir | |
| url | |
| |> Downloader.stream_body!() |
| defmodule MigrateRedis do | |
| require Logger | |
| @from [host: "127.0.0.1", port: 6379] | |
| @to [host: "127.0.0.1", port: 6379] | |
| def migrate(from \\ @from, to \\ @to) do | |
| {:ok, from} = Redix.start_link(from) | |
| {:ok, to} = Redix.start_link(to) |
| class Weather::Interpolation | |
| def initialize(x, y, z, xi, yi) | |
| @x, @y, @z, @xi, @yi = x, y, z, xi, yi | |
| end | |
| def calc | |
| # if any location closer than 10km, return this location | |
| close_location = distances.index {|d| d < 10} | |
| close_location ? @z[close_location] : interpolation | |
| end |
| ###################################################### | |
| # Tree Variables ##################################### | |
| # number of edges 4 | |
| # edge flows [0, 0, 0, 0, 10.0, 5.0, -0.0, -0.0] | |
| # node potentials [10752.0, -5376.0, -5376.0, -5376.0] | |
| # parent nodes [0, 1, 2, 3] | |
| # edges to parents [4, 5, 6, 7] | |
| # subtree sizes [1, 1, 1, 1] | |
| # next nodes in dfs thread [0, 1, 2, 3] | |
| # previous nodes in dfs thread [0, 1, 2, 3] |
| <script> | |
| import YieldService from '@/services/yieldService' | |
| export default { | |
| name: 'portfolio-summary', | |
| props: ['farms'], | |
| methods: { | |
| totalArea: function () { | |
| return this.farms.reduce((a, b) => a + b.areaUsed, 0) | |
| }, |