Skip to content

Instantly share code, notes, and snippets.

View lzap's full-sized avatar
🇪🇺
I break software for living.

Lukáš Zapletal lzap

🇪🇺
I break software for living.
View GitHub Profile
@lzap
lzap / harmless-playbook.yaml
Created November 3, 2021 18:48
Example Ansible playbook
---
- name: Ensure vim on localhost1
hosts: localhost1
remote_user: root
tasks:
- name: Ensure vim-minimal is installed
ansible.builtin.yum:
name: vim-minimal
state: latest
@lzap
lzap / main.go
Created April 5, 2022 11:47
AWS SDK V2 test
package main
import (
"context"
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/ec2"
@lzap
lzap / instance.go
Created April 6, 2022 10:53
Create an EC2 instance in Go SDK V2
func CreateInstance(client *ec2.Client) {
input := &ec2.RunInstancesInput{}
input.DryRun = aws.Bool(true)
input.ImageId = aws.String("ami-08c308b1bb265e927")
input.InstanceType = types.InstanceTypeT3Micro
input.MinCount = aws.Int32(1)
input.MaxCount = aws.Int32(1)
resp, err := client.RunInstances(context.TODO(), input)
if err != nil {
fmt.Println(err)
@lzap
lzap / azure-lighthouse-subscription-vm-management.json
Last active August 19, 2022 08:10
MS Azure Lighthouse Test: lzap's personal account
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mspOfferName": {
"type": "string",
"metadata": {
"description": "Specify a unique name for your offer"
},
"defaultValue": "Red Hat Cloud Provisioning"
@lzap
lzap / test-subscription.json
Last active November 16, 2022 12:08
Example Lighthouse subscription - redhat.com tenant
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mspOfferName": {
"type": "string",
"metadata": {
"description": "Specify a unique name for your offer"
},
"defaultValue": "Red Hat Cloud Provisioning"
@lzap
lzap / otelpgx5.patch
Created September 23, 2022 10:13
OpenTelemetry provisioning patch for pgx/v5
Index: internal/db/connection.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/internal/db/connection.go b/internal/db/connection.go
--- a/internal/db/connection.go (revision c976e66ddccd4ba8ed8cb5e7e82686161aa305cb)
+++ b/internal/db/connection.go (date 1663920062746)
@@ -1,15 +1,20 @@
package db
package main
import (
"fmt"
"time"
)
func main() {
start := time.Now()
_ = p0(200_000)
@lzap
lzap / gf.sh
Last active April 13, 2023 07:48
Script to fetch all branches and fast forward merge master/main/develop without checkout
#!/bin/bash
#UPSTREAM=origin
UPSTREAM=upstream
function bexists() {
local branch=${1}
local existed_in_local=$(git branch --list ${branch})
if [[ -z ${existed_in_local} ]]; then
@lzap
lzap / bench.diff
Created April 27, 2023 17:10
Updated benchmark results for sqlite3 for article https://blog.jetbrains.com/go/2023/04/27/comparing-db-packages/
diff --git a/go-db-comparison/benchmarks/benchmark.go b/go-db-comparison/benchmarks/benchmark.go
index b6dc9f9..17e4955 100644
--- a/go-db-comparison/benchmarks/benchmark.go
+++ b/go-db-comparison/benchmarks/benchmark.go
@@ -6,30 +6,34 @@ import (
"log"
"time"
- "gorm.io/driver/mysql"
"gorm.io/gorm"
@lzap
lzap / benchmark.go
Created April 29, 2023 11:18
Fixed benchmark and results from the https://blog.jetbrains.com/go/2023/04/27/comparing-db-packages/ blog post
package main
import (
"context"
"database/sql"
"fmt"
"log"
"time"
"gorm.io/gorm"