Skip to content

Instantly share code, notes, and snippets.

View radutopala's full-sized avatar
🦅
Building in Go @trisoftro #golang

Radu Topala radutopala

🦅
Building in Go @trisoftro #golang
View GitHub Profile
@airbornelamb
airbornelamb / rexray-minio.md
Last active January 3, 2021 11:58 — forked from harshavardhana/README.md
REX-Ray with Minio

Getting Started

The following commands will install the latest version of REX-Ray to /usr/bin/rexray on Linux systems:

$ sudo apt install s3fs
$ curl -sSL https://dl.bintray.com/rexray/rexray/install | sh -s stable

Depending on the Linux distribution, REX-Ray will be registered as either a SystemD or SystemV service.

Configure

REX-Ray requires a configuration file for storing details used to communicate with storage providers. This can include authentication credentials and driver specific configuration options. After REX-Ray has been installed, copy and paste the contents below to a new file on the host at /etc/rexray/config.yml to configure s3fs storage driver.

@miguelmota
miguelmota / interface_to_bytes.go
Last active February 24, 2024 00:07
Golang interface to bytes using gob encoder
package main
import (
"encoding/gob"
"bytes"
)
func GetBytes(key interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
@alex-leonhardt
alex-leonhardt / main.go
Last active October 11, 2024 11:34
golang text/template with a map[string]interface{} populated from mixed json data
package main
import (
"encoding/json"
"os"
"reflect"
"text/template"
)
@ianmiell
ianmiell / gist:a279edb1d102c519f96ca1961d630a51
Last active January 18, 2022 17:50
Show all crons running on your system
#!/bin/bash
# Adapted from an answer on: https://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users
set -eu
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
@dontstopbelieveing
dontstopbelieveing / online_store.sql
Last active May 22, 2023 15:04
Using JSON with MySQL 5.7–compatible Amazon Aurora
--Creating the database
DROP DATABASE online_store;
CREATE DATABASE online_store;
--Creating supporting tables
USE online_store;
CREATE TABLE brands (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
@irvingpop
irvingpop / ssh_key.tf
Last active January 23, 2025 09:07
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@posener
posener / go-shebang-story.md
Last active October 2, 2025 23:42
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@xeoncross
xeoncross / traverse_node.go
Created January 5, 2017 16:29
Simple DOM node traversal in golang using a very useful collector/matcher function
package main
import (
"bytes"
"fmt"
"io"
"strings"
"unicode"
"golang.org/x/net/html"
@walm
walm / main.go
Last active September 21, 2025 16:52
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@FZambia
FZambia / himawari.go
Last active December 5, 2019 18:14
Download Earth images from Himawari-8 satellite
// This script downloads Earth images from Himawari-8 satellite.
//
// After all images saved you can run this to generate video with ffmpeg:
//
// ffmpeg -framerate 20 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p video.mp4
// ffmpeg -i video.mp4 -i Morning_Mood_by_Grieg.mp3 -vcodec copy -acodec copy -shortest audiovideo.mp4
// ffmpeg -i audiovideo.mp4 -vf pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2" output.mp4
//
// Most of code here from https://github.com/avinashbot/himawari
package main