Skip to content

Instantly share code, notes, and snippets.

View saidaspen's full-sized avatar

saidaspen

  • Stockholm, Sweden
View GitHub Profile
@saidaspen
saidaspen / ubuntu_fresh_install.md
Last active May 23, 2018 11:11
Ubuntu Fresh Installation

Background

Applications

  • VPN: Mullvad
  • IntelliJ
  • Sublime
  • Git
  • Java
  • Tmux
@saidaspen
saidaspen / analys_vmelvan_omg1.md
Last active June 15, 2018 13:03
Analys: VM Elvan Omgång 1

Analys av VM-Elvan

När ungen sover får man tid att göra sådana här dumheter. Analys av hur vi valt spelare i VM-Elvan.

Allmänt

Första delen är allmän analys utan att dyka djupare i varje enskilt lag. Vilka spelare och länder är populära? Vilka är mindre populära?

Favoritland

Sammanställning av hur många seplare vi valt från de olika länderna (minst 3 spelare).

@saidaspen
saidaspen / to_learn_and_improve.md
Last active June 22, 2018 06:27
Things that I want to learn

General work related skills

Communication

  1. Public speaking

Technology

Programming and scripting Languages

  1. Golang
  2. Python
  3. Rust
@saidaspen
saidaspen / config.go
Last active September 17, 2018 04:35
Did configuration - Seems overly complex!
// Config holds the properties and values used for configuration
type Config struct {
dateFormat string
}
// DefaultConfig is the set of configuration values used if none other is given.
var DefaultConfig = Config{"2006-01-02"}
// FromFile returns the configuration to use for did
func FromFile(path string) (c Config, e error) {
@saidaspen
saidaspen / Aoc07.java
Last active December 7, 2019 14:16
AOC2019 07 Java
package se.saidaspen.aoc2019.aoc07;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
import java.util.stream.IntStream;
@saidaspen
saidaspen / example.rs
Created April 23, 2020 12:11
Nested hashmap
let mut scores: HashMap<String, HashMap<String, u32>> = HashMap::new();
1 for repo in tracked_repos {
2 let contributions: Vec<Contribution> = gh
3 .get_contributors(&repo)
4 .expect("unable to get contributors for repo")
5 .iter()
6 .filter(|c| participants_set.contains(&c.login))
7 .cloned()
8 .collect();
9 for contrib in contributions {
@saidaspen
saidaspen / 2017Day21.kt
Created August 25, 2020 00:33
Advent of Code 2017 Day21 - Does not work
package aoc207
import java.io.File
fun main() {
val input = File(ClassLoader.getSystemResource("201721").file).readText()
println("Part 1: " + Day21(input).part1(5))
}
class Day21(input: String) {
@saidaspen
saidaspen / 2017Day21Tests.kt
Created August 25, 2020 00:40
Advent of Code 2017 Day 21 Unit tests
package aoc207
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
internal class Day21Test {
@Test
fun p1() {
@saidaspen
saidaspen / Aoc2017D21.kt
Last active August 29, 2020 22:05
Advent of Code 2017 Day 21
fun main() {
val input = java.io.File(ClassLoader.getSystemResource("201721").file).readText().trim()
println("Part 1: " + Day21().part1(input, 5))
println("Part 2: " + Day21().part1(input, 18))
}
typealias G = Grid<Char>
typealias P<A, B> = Pair<A, B>
class Day21 {
@saidaspen
saidaspen / main.rs
Created September 18, 2020 21:06
Type annotation?
#[post("/new")]
async fn new(req_body: String) -> impl Responder {
match serde_json::from_str(req_body.as_str()) {
Err(why) => HttpResponse::BadRequest().body(
json!({
"err": "Unable to parse input as request json",
})
.to_string(),
),
Ok(t) => HttpResponse::Ok().body(format!("{:?}", t)),