Skip to content

Instantly share code, notes, and snippets.

@gastonfartek
gastonfartek / day15.rs
Created December 31, 2021 16:18
AOC day 15 Dijkstra's
use std::{
cmp::Ordering,
collections::{BinaryHeap, HashMap, HashSet},
fs::read_to_string,
};
#[derive(Clone, Debug)]
struct Vertex {
row: usize,
column: usize,
@gastonfartek
gastonfartek / day6.rs
Last active December 7, 2021 01:41
adventofcode day6 part2
use std::collections::HashMap;
static DATA: &str = "3,5,1,2,5,4,1,5,1,2,5,5,1,3,1,5,1,3,2,1,5,1,1,1,2,3,1,3,1,2,1,1,5,1,5,4,5,5,3,3,1,5,1,1,5,5,1,3,5,5,3,2,2,4,1,5,3,4,2,5,4,1,2,2,5,1,1,2,4,4,1,3,1,3,1,1,2,2,1,1,5,1,1,4,4,5,5,1,2,1,4,1,1,4,4,3,4,2,2,3,3,2,1,3,3,2,1,1,1,2,1,4,2,2,1,5,5,3,4,5,5,2,5,2,2,5,3,3,1,2,4,2,1,5,1,1,2,3,5,5,1,1,5,5,1,4,5,3,5,2,3,2,4,3,1,4,2,5,1,3,2,1,1,3,4,2,1,1,1,1,2,1,4,3,1,3,1,2,4,1,2,4,3,2,3,5,5,3,3,1,2,3,4,5,2,4,5,1,1,1,4,5,3,5,3,5,1,1,5,1,5,3,1,2,3,4,1,1,4,1,2,4,1,5,4,1,5,4,2,1,5,2,1,3,5,5,4,5,5,1,1,4,1,2,3,5,3,3,1,1,1,4,3,1,1,4,1,5,3,5,1,4,2,5,1,1,4,4,4,2,5,1,2,5,2,1,3,1,5,1,2,1,1,5,2,4,2,1,3,5,5,4,1,1,1,5,5,2,1,1";
fn main() {
let input: Vec<i8> = DATA.split(",").map(|x| x.parse::<i8>().unwrap()).collect();
let mut fish_per_day_map: HashMap<i8, i64> = HashMap::new();
for day in input {
*fish_per_day_map.entry(day).or_insert(0) += 1;
@gastonfartek
gastonfartek / test.py
Created December 30, 2018 17:41
Python test
import json
from urllib.request import urlopen
response = urlopen('https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVin/1HD1BX5158Y047710?format=json')
responseData = response.read();
json = json.loads(responseData)
data = list(filter(lambda r: r['VariableId'] == 26 or r['VariableId'] == 28 or r['VariableId'] == 29, json['Results']))
print(data)
@gastonfartek
gastonfartek / DarculaModified.icls
Created February 23, 2017 18:08
Darcula theme modified
<scheme name="Darcula - Modified” version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2017-02-21T17:36:45</property>
<property name="ide">idea</property>
<property name="ideVersion">2016.3.4.0.0</property>
<property name="modified">2017-02-21T17:40:08</property>
<property name="originalScheme">_@user_Darcula</property>
</metaInfo>
<option name="LINE_SPACING" value="1.2" />
<option name="EDITOR_FONT_SIZE" value="12" />