Skip to content

Instantly share code, notes, and snippets.

from collections import defaultdict
import numpy as np
item = 'cauldron', 1 # edit to set which item will be modelled
collect_immediately = True # whether drops will be collected asap or later at max lvl
num_simulations = 10000
equivalents = {
'coins': [1, 3, 8, 20, 50, 120],
'gemstone': [1, 3, 8, 20],
#!/bin/bash
set -e -o pipefail -x
chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown -R root:root $LFS/lib64 ;;
esac
mkdir -pv $LFS/{dev,proc,sys,run}
mount -v --bind /dev $LFS/dev
mount -v --bind /dev/pts $LFS/dev/pts
#!/bin/bash
set -e -o pipefail -x
cd $LFS/sources
tar --extract --file binutils-2.39.tar.xz
cd binutils-2.39
mkdir -v build
cd build
time { ../configure --prefix=$LFS/tools \
@escalonn
escalonn / lfs1.sh
Last active September 29, 2022 09:09
#!/bin/bash
set -e -o pipefail -x
export DEBIAN_FRONTEND=noninteractive
echo 'deb http://deb.debian.org/debian/ bullseye contrib non-free' | sudo tee /etc/apt/sources.list.d/other.list
sudo apt update
sudo apt full-upgrade
sudo apt autoremove
sudo apt install \
bash \
bash-completion \
// run with dotnet run
using System.Reflection;
using P0;
Console.WriteLine("Running P0 tests...");
int passed = 0, failed = 0;
IEnumerable<MethodInfo> testMethods = typeof(UnitTests).GetMethods()
.Where(m => m.GetCustomAttributes(typeof(UnitTestAttribute)).Any());
foreach (MethodInfo method in testMethods)
import re
words = {}
for i in range(int(input())):
word = input().lower()
words[re.sub('[a-z]', lambda m: 'z' if m.group() in 'aeiou' else 's', word)] = word
print(re.sub(r'\w+',
lambda m: ''.join(c2.upper() if c1.isupper() else c2
for c1, c2 in zip(m.group(), words[m.group().lower()])),
// example: dotnet run -- words_alpha.txt cat"
string dictionary = args[0];
string tiles = args[1];
Dictionary<string, List<string>> groups = File.ReadLines(path: dictionary)
.GroupBy(Alphabetize)
.ToDictionary(g => g.Key, g => g.ToList());
// .NET language server, displays errors and warnings in real time
// usage: dotnet LanguageServer.dll [PROJECT|SOLUTION]
// dotnet run -- [PROJECT|SOLUTION]
// example: dotnet run --project ../LanguageServer -- .
using System.Diagnostics;
string project = args[0];
string directory =
// Hello world HTTP server, listens on port 5000
// usage: dotnet Hello.dll
// dotnet run
using System.Net;
using System.Net.Sockets;
using System.Security;
string text = "Hello, World!";
using System;
using System.Net;
using System.Net.Http;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using Microsoft.AspNetCore.Mvc.Testing;
using ServerSide;
using Xunit;