Skip to content

Instantly share code, notes, and snippets.

View aloisdg's full-sized avatar
🏠
Working from home

Aloïs de Gouvello aloisdg

🏠
Working from home
View GitHub Profile
using System;
using System.Linq;
public class Program
{
public static (string, string) Half(string s) => (s[..(s.Length / 2)], s[(s.Length / 2)..]);
public static int Prioritize(char c) => c - (char.IsLower(c) ? 'a' : ('A' - 26)) + 1;
public static void Main()
{
@aloisdg
aloisdg / Day2_1.cs
Last active December 2, 2022 10:55
Advent_2022_2
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var s = @"A Y
B X
C Z";
@aloisdg
aloisdg / code.cs
Last active December 1, 2022 11:27
Advent_2022_1
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var s = @"1000
2000
3000
@aloisdg
aloisdg / appendPath.js
Last active November 14, 2022 20:51
Add path to url
// https://stackoverflow.com/questions/27846195/how-can-i-add-the-current-pathname-to-a-href-with-a-different-url/74437330#74437330
// https://jsfiddle.net/t41z39fv/
const cases = [
["http://a.b", "a", "http://a.b/a"],
["http://a.b", "/a", "http://a.b/a"],
["http://a.b/", "a", "http://a.b/a"],
["http://a.b/a", "a", "http://a.b/a/a"],
["http://a.b/a/", "a", "http://a.b/a/a"],
["http://a.b", "a/a", "http://a.b/a/a"],
@aloisdg
aloisdg / lookup.cs
Created October 13, 2022 16:26
Deconstruct Lookup
// https://stackoverflow.com/questions/42549491/deconstruction-in-foreach-over-dictionary
// https://codereview.stackexchange.com/questions/233528/deconstruct-tuple-and-store-each-element-into-a-list-of-their-respective-element
// https://dotnetfiddle.net/GWXy8i
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
@aloisdg
aloisdg / print-password.sh
Created July 20, 2022 07:31
A small utility to print the password to the current or a given ssid
#!/bin/bash
ssid=""
if [ $# -eq 0 ] || [ -z "$1" ]
then
current=$(iwgetid -r)
ssid="${current}.nmconnection"
else
ssid=$(sudo ls /etc/NetworkManager/system-connections/ | grep "$1")
fi
@aloisdg
aloisdg / science.md
Last active June 9, 2022 17:06
Kata 7 Wonders Sciences

Kata 7 Wonders Sciences

Scientific Structures are a set collecting aspect to the game of 7 Wonders. Throughout the game you, as the player, will occasionally come across one of three types of Scientific Structure. They could have a Gear on them, a Compass on them, or a Tablet. There are 8 of each card in the game, spread across the ages, and you get points for collecting them in different ways.

Although there are 8 of each of the three types of card, it is impossible to collect all 8 in the base game (although not with the Leaders expansion). This is because there are 24 Scientific Structures and the maximum number of cards you can have in the game is 18.

Step 1

Firstly, you get squared points for each multiple of an icon you have. For instance, if you have 1 gear, you will get 12 points. If you have 2 gears then you get 22 points. If you have 3 gears then you will get 32 points. You get the idea.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
html {
background-color: white;
}
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
// https://bowlingguidance.com/all-about-strikes-and-spares-in-bowling/
static int Score(IList<int> pins)
{
bool startsWithStrike(IList<int> list) => list[0] == 10;
Write-Host "wesh"