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
def example_1 | |
clean_env = false | |
t = Thread.new do | |
begin | |
ensure | |
clean_env = true | |
end | |
end | |
t.kill | |
t.join |
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
Nemo calls out to Panda and Nightingale: | |
What status should Nemo return when: | |
Scenario 1: | |
Panda returns a 200 | |
Nightingale returns a 500 | |
Scenario 2: | |
Panda returns a 404 |
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
# Problem 3 | |
# The prime factors of 13195 are 5, 7, 13 and 29. | |
# What is the largest prime factor of the composite 600851475143 ? | |
# This solution was taken and modified from https://github.com/JordiPolo/euler_on_elixir | |
defmodule Euler.Problem2 do | |
def solve 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
class PartyParrot | |
class << self | |
def party! | |
post_to_slack do | |
"#{party_parrot_key} " * 100 | |
end | |
end | |
private |
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
curl https://acrnm.com/products/J16-GT_FW1718 | grep -o '<img[ ]*src="[^"]*"' | sed "s/<img src=\"/https:\/\/acrnm.com/" | sed "s/\"//" | xargs -L 1 catpix |
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 socket | |
import os | |
channel = os.environ["CHANNEL"] | |
def _handshake(server): | |
# Get the value for this here: https://twitchapps.com/tmi/ | |
token = os.environ["TWITCH_OAUTH_TOKEN"] | |
# Note the bot name will not be what is specifed here, |
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
# Stolen from: https://medium.com/survata-engineering-blog/monitoring-memory-usage-of-a-running-python-program-49f027e3d1ba | |
print("\33c") | |
import tracemalloc | |
def measure_memory(func): | |
tracemalloc.start() |
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 pytest | |
# DON'T UPDATE THIS JUST CREATE A CONTEXT MANAGER | |
def reverso(): | |
with YOUR_CONTEXT_MANAGER as what: | |
return print("Alice, Kitty and Snowdrop") | |
def test_looking_glass(capsys): | |
reverso() |
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 pytest | |
def while_with_else_1(): | |
x = True | |
while x: | |
print("It's been a while!") | |
x = False | |
else: | |
return "Goodbye my sweet love" |
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 pytest | |
from cool_code import * | |
def test_something(): | |
assert True |