Skip to content

Instantly share code, notes, and snippets.

View Miguel-Dorta's full-sized avatar

Miguel Dorta Miguel-Dorta

View GitHub Profile
@Miguel-Dorta
Miguel-Dorta / batchk.go
Created October 22, 2023 01:16
Simple script to check the battery in your server and notify you / turn it off
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/sys/unix"
"io"
"net/http"
@Miguel-Dorta
Miguel-Dorta / execHot.go
Created January 15, 2020 21:39
Execute a command when the CPU temp goes above (or below) X ºC
package main
import (
"flag"
"fmt"
"io/ioutil"
"math"
"os"
"os/exec"
"strconv"
@Miguel-Dorta
Miguel-Dorta / mc-log.go
Last active January 9, 2020 23:20
Simple script for concatenating minecraft log files
package main
import (
"bufio"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
@Miguel-Dorta
Miguel-Dorta / MinecraftSystemdWrapper.go
Last active April 18, 2020 23:12
Systemd wrapper for Minecraft servers.
// 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 / md5recursive.go
Last active May 21, 2019 18:07
Get the MD5 hash of a directory's content (recursively)
// 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 / rmOldFiles.go
Created November 26, 2018 01:48
Remove files older than N days from "/path/to/files" - Requires filename starting by YYYY-MM-DD
// MIT License <https://opensource.org/licenses/MIT> - Copyright (c) 2018 Miguel Dorta
package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"time"
)