This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| # How to get ClamAV working on CentOS 7 | |
| yum -y install epel-release && yum -y update | |
| yum -y install clamav clamav-data clamav-scanner clamav-scanner-systemd clamav-server clamav-server-systemd clamav-unofficial-sigs clamav-update | |
| # Add /etc/clamd.d/freshclam.conf | |
| # Add /usr/lib/systemd/system/clamav-freshclam.service | |
| systemctl enable clamav-freshclam.service && systemctl start clamav-freshclam.service |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os/exec" | |
| "runtime" | |
| ) | |
| type Worker struct { |
| package main | |
| import ("fmt"; "math") | |
| // interfaces | |
| type Shaper interface { | |
| area() float64 | |
| perimeter() float64 | |
| } | |
| # Download Go (use any of the latest versions) | |
| curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz | |
| # Extract Go | |
| tar -xvf go*.tar.gz | |
| # Install Go | |
| sudo mv go /usr/local | |
| # Create a workspace folder |
| // Also available at: https://play.golang.org/p/yTTpB5gB6C | |
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| // ***************************************************************************** | |
| // Example 1 - Struct vs Struct with Embedded Type |
(Assuming a Debian 8-like system)
Install prometheus-node-exporter
$ sudo apt update && sudo apt install prometheus-node-exporterConfigure prometheus-node-exporter to expose metrics only to localhost, not on to all networks. Modify file /etc/default/prometheus-node-exporter:
# Set the command-line arguments to pass to the server.| RECAPTCHA_PUBLIC_KEY = '<public key>' | |
| RECAPTCHA_PRIVATE_KEY = '<private key>' | |
| def checkRecaptcha(response, secretkey): | |
| url = 'https://www.google.com/recaptcha/api/siteverify?' | |
| url = url + 'secret=' + str(secretkey) | |
| url = url + '&response=' +str(response) |
| import random | |
| import os | |
| random.seed(42) | |
| F_PATH = "data.csv" | |
| OUTPUT_PATH_TEMPLATE = "tmp_%d.csv" | |
| CHUNK_SIZE = 5 |