Instantly share code, notes, and snippets.

View rss-redirect.html
<!DOCTYPE html>
<html>
<head>
<title>https://sw-samuraj.cz/index.xml</title>
<link rel="canonical" href="https://sw-samuraj.cz/index.xml"/>
<meta name="robots" content="noindex">
<meta http-equiv="content-type" content="application/rss+xml; charset=utf-8"/>
<meta http-equiv="refresh" content="0; url=https://sw-samuraj.cz/index.xml"/>
</head>
</html>
View prometheus-oci-sd.yml
scrape_configs:
- job_name: 'oci-sd'
scrape_interval: 5s
file_sd_configs:
- files:
- oci-sd.json
refresh_interval: 1m
relabel_configs:
- source_labels: ['__meta_oci_public_ip']
target_label: '__address__'
View oci-sd.json
[
{
"targets": [
"10.1.0.3:9100"
],
"labels": {
"__meta_oci_availability_domain": "YHQr:PHX-AD-3",
"__meta_oci_compartment_id": "ocid1.compartment.oc1..aaaaaaaa7gna34n3semxsi7ejf72jqpjnip6mqw2764hegwp7y2sl5rctdqa",
"__meta_oci_freeform_tag_prometheus_exporter": "node_exporter",
"__meta_oci_instance_id": "ocid1.instance.oc1.phx.abyhqljsjcdozybjh33phjwxzxfpjnqjvwtaltx7jneccjjuqumfdbk76dyq",
View oci-sd.toml
[SDConfig]
User = "ocid1.user.1"
FingerPrint = "42:42:42"
KeyFile = "/home/<user>/.oci/oci_api_key.pem"
PassPhrase = "secret"
Tenancy = "ocid1.tenancy.1"
Region = "us-phoenix-1"
Compartment = "ocid1.compartment.1"
View env-vars.sh
### Authentication details
export TF_VAR_tenancy_ocid="<tenancy OCID>"
export TF_VAR_user_ocid="<user OCID>"
export TF_VAR_private_key_path="<path to the private key that matches the fingerprint above>"
export TF_VAR_fingerprint="<PEM key fingerprint>"
# export TF_VAR_pass_phrase="<private key pass phrase>""
### Region
export TF_VAR_region="<region in which to operate, example: us-ashburn-1, us-phoenix-1>"
View hugo-gitlab-ci.yml
image: registry.gitlab.com/pages/hugo:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
pages:
script:
- hugo
artifacts:
paths:
View goroutines-closures-2.go
package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i <= 9; i++ {
i := i // Seems odd, but it's legal and idiomatic.
View goroutines-closures.go
package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i <= 9; i++ {
go func() { fmt.Println(i) }()
View symlink-tree.txt
View SymlinkTest.java
package com.example;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;