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
#!meta | |
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} | |
#!csharp | |
static string[] ones = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" }; | |
static string[] teens = { "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; | |
static string[] tens = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; | |
static string[] suffixes = { "", "thousand", "million", "billion" }; |
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
public class DictWithDefault<TKey, TValue> | |
{ | |
public readonly TValue DefaultValue; | |
private readonly Dictionary<TKey, TValue> values = new Dictionary<TKey, TValue>(); | |
public DictWithDefault(TValue defaultValue = default) | |
{ | |
this.DefaultValue = defaultValue; | |
} |
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
public class ExceptionHandler : IMiddleware | |
{ | |
public async Task InvokeAsync(HttpContext context, RequestDelegate next) | |
{ | |
try | |
{ | |
await next(context); | |
} | |
catch (Exception e) | |
{ |
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
sudo mkdir /home/steam/Valheim | |
cd /home/steam/Valheim | |
sudo /home/steam/steamcmd +login anonymous +force_install_dir /home/steam/Valheim +app_update 896660 validate +exit | |
sudo wget https://gist.githubusercontent.com/Regenhardt/29498e06af3c41091f53b6f8d7f3e1dc/raw/df2da2e4b6151dcb0ae33df2d2a88a4c329592a5/start_valheim.sh | |
cd /etc/systemd/system | |
sudo echo -e "[Unit]\nDescription=Valheim service\nWants=network.target\nAfter=syslog.target network-online.target\n\n[Service]\nType=simple\nRestart=on-failure\nRestartSec=10\nUser=steam\nWorkingDirectory=/home/steam/Valheim\nExecStart=/home/steam/Valheim/start_valheim.sh\n\n[Install]\nWantedBy=multi-user.target" > valheim.service | |
sudo chmod +x valheim.service | |
sudo systemctl daemon-reload | |
sudo systemctl start valheim |
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
# steamCMD user | |
sudo useradd -m steam | |
cd /home/steam | |
## 64-bit | |
sudo apt update && sudo apt upgrade | |
sudo apt install software-properties-common | |
sudo add-apt-repository multiverse | |
sudo dpkg --add-architecture i386 |
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
echo 'Download latest server version' | |
wget https://teamspeak.com/versions/server.json -qO - | jq '.linux.x86_64.mirrors["teamspeak.com"]' | xargs wget | |
# unpack | |
echo 'Unpack' | |
tar -xjvf teamspeak3-server_linux*.tar.bz2 | |
# backup ts3.sqlitedb | |
echo "Backup data from $1" | |
cp $1/ts3server.sqlitedb $1/ts3server.sqlitedb.bak -f | |
# copy over new stuff | |
echo "Updating $1" |
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
namespace regenhardt | |
{ | |
public static class TaskExtensions | |
{ | |
public static async Task<T> Data<T>(this Task<Result<T>> result) | |
{ | |
return (await result).Data; | |
} | |
} | |
} |
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/sh | |
### BEGIN INIT INFO | |
# Provides: ts3 | |
# Required-Start: $local_fs $network | |
# Required-Stop: $local_fs $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: TS3-Server | |
# Description: Teamspeak 3 Server | |
### END INIT INFO |
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
public static class SecureStringExtensions | |
{ | |
public static string GetSHA512(this SecureString input) | |
{ | |
using (var sha512 = SHA512.Create()) | |
{ | |
byte[] password = Encoding.UTF8.GetBytes(ToNormalString(input)); | |
byte[] hash = sha512.ComputeHash(password); | |
return Encoding.UTF8.GetString(hash); | |
} |
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
The element 'CodeSnippets' in namespace 'http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet' cannot contain text. | |
List of possible elements expected: 'CodeSnippet' in namespace 'http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet' |
NewerOlder