sudo snap install lxd
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
#Requires -Version 7.4 | |
#Requires -PSEdition Core | |
$ErrorActionPreference = 'Stop' | |
Set-StrictMode -Version Latest | |
<# | |
.SYNOPSIS | |
The same as Start-Process but with support of -CaptureOutput and -RedirectToStdout parameters. |
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 | |
# Tested with go 1.22.5 | |
project_name="my_project" # Change to your project name | |
main_file="${project_name}.go" # Or main.go, depends on your project structure | |
build_path="./build" | |
# Add values to your liking from "go tool dist list" command | |
# or https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63 |
Create minecraft/docker-compose.yml
:
services:
minecraft:
image: itzg/minecraft-server
container_name: minecraft
environment:
TYPE: FABRIC
SERVER_NAME: Dungeon
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
// Add to your Cargo.toml: | |
// [dependencies] | |
// subprocess = { version = "0.2.10", git = "https://github.com/SCP002/rust-subprocess.git" } | |
use subprocess::Exec; | |
fn main() { | |
let exit_status = Exec::cmd("my-executable-name") | |
.arg("arg1") | |
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE |
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
// Add to your Cargo.toml: | |
// [dependencies] | |
// utf8-chars = "1.0.0" | |
// subprocess = { version = "0.2.10", git = "https://github.com/SCP002/rust-subprocess.git" } | |
use std::io; | |
use std::io::BufReader; | |
use std::io::Write; | |
use subprocess::Exec; | |
use subprocess::ExitStatus; |
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
// Add to your Cargo.toml: | |
// [dependencies] | |
// rayon = "1.1" | |
use rayon::prelude::*; | |
use rayon::ThreadPoolBuilder; | |
use std::thread; | |
use std::time::{Duration, Instant}; | |
fn main() { |
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
// Add to your Cargo.toml: | |
// [dependencies] | |
// serde = { version = "1.0.193", features = ["derive"] } | |
// serde_json = "1.0.108" | |
use serde::{Deserialize, Serialize}; | |
use serde_json::{Map, Value}; | |
#[derive(Serialize, Deserialize)] | |
struct TopStruct { |
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
# write systemd config for the first instance | |
sudo tee /lib/systemd/system/astra-8000.service > /dev/null << ENDSEQ | |
[Unit] | |
Description=Astra 8000 service (%N) | |
After=network-online.target | |
StartLimitBurst=5 | |
StartLimitIntervalSec=10 | |
[Service] | |
Type=simple |
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
package main | |
import ( | |
"errors" | |
"net" | |
"net/url" | |
"syscall" | |
) | |
// ErrType represents network error type |
NewerOlder