This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()])), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder