Skip to content

Instantly share code, notes, and snippets.

Avatar

Miguel Dorta Miguel-Dorta

View GitHub Profile
@Miguel-Dorta
Miguel-Dorta / rmOldFiles.go
Created Nov 26, 2018
Remove files older than N days from "/path/to/files" - Requires filename starting by YYYY-MM-DD
View rmOldFiles.go
// MIT License <https://opensource.org/licenses/MIT> - Copyright (c) 2018 Miguel Dorta
package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"time"
)
@Miguel-Dorta
Miguel-Dorta / md5recursive.go
Last active May 21, 2019
Get the MD5 hash of a directory's content (recursively)
View md5recursive.go
// MIT License <https://opensource.org/licenses/MIT> - Copyright (c) 2019 Miguel Dorta
package main
import (
"crypto/md5"
"fmt"
"io"
"os"
"path/filepath"
)
@Miguel-Dorta
Miguel-Dorta / MinecraftSystemdWrapper.go
Last active Apr 18, 2020
Systemd wrapper for Minecraft servers.
View MinecraftSystemdWrapper.go
// MIT License <https://opensource.org/licenses/MIT> - Copyright (c) 2020 Miguel Dorta
package main
import (
"fmt"
"golang.org/x/sys/unix"
"io"
"os"
"os/exec"
"os/signal"
@Miguel-Dorta
Miguel-Dorta / mc-log.go
Last active Jan 9, 2020
Simple script for concatenating minecraft log files
View mc-log.go
package main
import (
"bufio"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
@Miguel-Dorta
Miguel-Dorta / execHot.go
Created Jan 15, 2020
Execute a command when the CPU temp goes above (or below) X ºC
View execHot.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"math"
"os"
"os/exec"
"strconv"