Skip to content

Instantly share code, notes, and snippets.

View johngian's full-sized avatar

John Giannelos johngian

View GitHub Profile
@johngian
johngian / advent-of-code-2021-day9-part-1.ex
Created December 10, 2021 10:26
Advent of code 2021 - day 9 - part 1 - solution
defmodule Smoke do
def read(path) do
[h | t] =
File.read!(path)
|> String.split("\n")
|> Enum.map(fn x ->
String.codepoints(x)
|> Enum.map(&String.to_integer/1)
|> (fn x -> [10] ++ x ++ [10] end).()
end)
@johngian
johngian / advent-of-code-2021-day5.ex
Created December 6, 2021 00:15
Advent of code 2021 - day 5 - part 2 - solution
defmodule Vents do
def parsepoint(point) do
point
|> String.split(",", trim: true)
|> Enum.map(&String.trim/1)
|> Enum.map(&String.to_integer/1)
end
def parseline(line) do
line
@johngian
johngian / advent-of-code-2021-day4.exs
Created December 5, 2021 21:47
Advent of code 2021 - day 4 - part 2 - solution
defmodule Bingo do
def parseline(line) do
line
|> String.split(" ", trim: true)
|> Enum.map(&String.to_integer/1)
end
def parseboard(board) do
Enum.map(board, &parseline/1)
end
@johngian
johngian / advent-of-code-2021-day4.exs
Created December 5, 2021 19:11
Advent of code 2021 - day 4 - part 1 - solution
defmodule Bingo do
def parseline(line) do
line
|> String.split(" ", trim: true)
|> Enum.map(&String.to_integer/1)
end
def parseboard(board) do
Enum.map(board, &parseline/1)
end
@johngian
johngian / advent-of-code-2021-day3.cpp
Created December 5, 2021 09:58
Advent of code 2021 - day 3 - solution
#include <iostream>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>
#include <tuple>
#include <numeric>
#include <bitset>
#include <math.h>
#include <day3.hpp>
@johngian
johngian / advent-of-code-2021-day2.cpp
Created December 5, 2021 09:56
Advent of code 2021 - day 2 - solution
#include <iostream>
#include <cmath>
#include <map>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <day2.hpp>
namespace day2
{
std::string solution_part1(std::istream &std_input)
@johngian
johngian / advent-of-code-2021-day1.cpp
Last active December 5, 2021 09:56
Advent of code 2021 - day1 - solution
#include <iostream>
#include <boost/format.hpp>
#include <day1.hpp>
namespace day1
{
std::string solution(std::istream &std_input)
{
int increased = 0;
int prev, curr;
<?xml version="1.0" encoding="utf-8"?>
<opml version="2.0">
<head>
<title>gPodder subscriptions</title>
<dateCreated>Thu, 18 Nov 2021 11:14:12 +0100</dateCreated>
</head>
<body>
<outline title="Berlin Briefing" text="We browse local news stories from Berlin (mostly reported in German) every weekday morning and report them back in a succinct five to ten minute summary. In English." xmlUrl="http://berlinbriefing.podigee.io/feed/aac" type="rss"/>
<outline title="Χίλιες και Μία Νύχτες" text="Ιστορικά πάρτι, θρυλικές συναυλίες, ανεπανάληπτα φεστιβάλ, αξέχαστα events. Ο Θεοδόσης Μίχος μαζεύει τα κομμάτια του μεγάλου παζλ της αθηναϊκής νυχτερινής ζωής μέσα από τις γλαφυρές αφηγήσεις των εκλεκτών καλεσμένων του -μουσικών, εικαστικών, ηθοποιών, σκηνοθετών, συγγραφέων, σεφ, DJs, ραδιοφωνικών παραγωγών, δημοσιογράφων, κ.α.- που βρέθηκαν στο σωστό μέρος τη σωστή στιγμή." xmlUrl="https://feeds.simplecast.com/XEFe6RQa" type="rss"/>
<outline title="3 στον αέρα" text="Χαλαρ

Chaos engineering + toxiproxy

Test setup

version: "3.3"
services:
  toxiproxy:
    image: "shopify/toxiproxy:latest"
    ports:
 - "8474:8474"