Skip to content

Instantly share code, notes, and snippets.

View ggirtsou's full-sized avatar
🎯
Focusing

George Gkirtsou ggirtsou

🎯
Focusing
View GitHub Profile
@ggirtsou
ggirtsou / main_test.go
Created July 16, 2018 20:39
Some benchmarking just for fine
package main
import "testing"
/**
go test -v -bench=.
goos: linux
goarch: amd64
pkg: github.com/ggirtsou/benchmark
BenchmarkSliceLookup-8 200000 6651 ns/op
package main
import (
"testing"
)
/*
go test -v .
=== RUN TestBinarySearch
--- PASS: TestBinarySearch (0.00s)
@ggirtsou
ggirtsou / local-repos-init.sh
Created October 13, 2018 15:34
A bash script I wrote to set up local directories as git repos
#/bin/bash
set -x
set -e
repos=(ai-labs cloud-backup cloud-cli cloud-compute cloud-configuration cloud-container-registry cloud-dashboard cloud-database cloud-dns cloud-identity cloud-key-management cloud-load-balancer cloud-memory-db cloud-networking cloud-nosql-db cloud-orchestrator cloud-persistent-volume cloud-protect cloud-pubsub cloud-rdbms-db cloud-search-engine cloud-storage cloud-time-series-db code-build monitoring-agent monitoring-aggregation monitoring-alerting monitoring-anomaly-detection monitoring-collection monitoring-processing monitoring-visualisation video-conference)
for repo in "${repos[@]}"
do
cd $repo && \
@ggirtsou
ggirtsou / remote-repos-init.sh
Created October 13, 2018 15:35
A bash script I wrote to create bare repositories on git.byteslice.co.uk: gitweb runs on http://git.byteslice.co.uk/
#/bin/bash
set -x
set -e
repos=(ai-labs.git cloud-backup.git cloud-cli.git cloud-compute.git cloud-configuration.git cloud-container-registry.git cloud-dashboard.git cloud-database.git cloud-dns.git cloud-identity.git cloud-key-management.git cloud-load-balancer.git cloud-memory-db.git cloud-networking.git cloud-nosql-db.git cloud-orchestrator.git cloud-persistent-volume.git cloud-protect.git cloud-pubsub.git cloud-rdbms-db.git cloud-search-engine.git cloud-storage.git cloud-time-series-db.git code-build.git monitoring-agent.git monitoring-aggregation.git monitoring-alerting.git monitoring-anomaly-detection.git monitoring-collection.git monitoring-processing.git monitoring-visualisation.git video-conference.git)
for repo in "${repos[@]}"
do
cd $repo && git init --bare && cd ../
@ggirtsou
ggirtsou / generate_table_of_contents.sh
Created November 17, 2018 09:11
Bash script that extracts HTML title tag from files and creates a table of contents. Assumes files are named {number}.html.
#!/bin/bash
END=$(ls -l | grep ".html" | wc -l)
START=1
for (( i=$START; i<=$END; i++ ))
do
cat ./$i.html | grep -oE "<title>.*</title>" | sed 's/<title>/'"$i"'.html /' | sed 's/<\/title>//' | head -n 1;
done
@ggirtsou
ggirtsou / main.go
Last active July 20, 2019 20:43
The mapreduce programming model in Go. This is for big data scenarios where all data cannot be loaded at once and we distribute the computations in many nodes. In this example the goroutines represent nodes.
package main
import (
"strings"
"sync"
"github.com/davecgh/go-spew/spew"
)
func main() {