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.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() {
@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 / 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 / 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 && \
package main
import (
"testing"
)
/*
go test -v .
=== RUN TestBinarySearch
--- PASS: TestBinarySearch (0.00s)
@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

Keybase proof

I hereby claim:

  • I am ggirtsou on github.
  • I am ggirtsou (https://keybase.io/ggirtsou) on keybase.
  • I have a public key whose fingerprint is 68BE 33D5 92AF 5EF1 8873 E9AC 5563 1C32 1936 0BE0

To claim this, I am signing this object:

@ggirtsou
ggirtsou / client.go
Created October 29, 2016 09:10
Delete all fork repositories from your Github account in one go, using this Golang script :)
/*
* CAUTION!!! READ THIS VERY CAREFULLY!!!
* This will delete ALL your Github fork repositories.
* DO NOT use it if you don't know what it does!
*
* Usage:
* $ go get # get dependencies
* $ go run client.go # initiate chaos
*/
package main
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
var m = map[string]int{}
words := strings.Fields(s)
@ggirtsou
ggirtsou / build.xml
Created July 17, 2016 18:35
Sample Apache Ant configuration file
<?xml version="1.0" encoding="UTF-8"?>
<project name="My Project" basedir=".">
<property name="app" location="app" />
<property name="build" location="app/logs/build" />
<delete dir="${build}" />
<echo message="Create build dir"/>
<mkdir dir="${build}" />
<echo message="Drop test database"/>