Skip to content

Instantly share code, notes, and snippets.

@humangrass
humangrass / graphql.go
Last active May 6, 2024 12:27
Golang graphql example. HTTP-POST
package main
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"time"
"github.com/graphql-go/graphql"
@humangrass
humangrass / handyman.go
Last active May 6, 2024 12:41
Handyman - Golang Task Runner | Scheduler Example
package main
import (
"fmt"
"log"
"time"
"github.com/robfig/cron"
)
@humangrass
humangrass / updater.sh
Last active May 6, 2024 12:43
A tool for quickly updating projects. Use `chmod +x puller.sh` to make it executable
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <path_to_projects_folder>"
exit 1
fi
pull_if_git_repo() {
local dir="$1"
if [ -d "$dir/.git" ]; then
@humangrass
humangrass / stopper.sh
Last active April 18, 2024 04:55
Docker container stopper. Allows you to close various containers that continue to work for more than a certain time.
#!/bin/bash
setup_logger() {
local path="$1"
exec 3>&1 4>&2
exec 1>>"$path" 2>&1
}
log() {
local message="$1"