Skip to content

Instantly share code, notes, and snippets.

👀
Looking for new opportunities

Max Ivanov groovili

👀
Looking for new opportunities
View GitHub Profile
@groovili
groovili / lambda_cloudwatch_schedule.tf
Last active Nov 13, 2018
AWS CloudWatch schedule for lambda execution
View lambda_cloudwatch_schedule.tf
resource "aws_lambda_function" "check" {
filename = "./check.zip"
function_name = "check"
role = "arn:aws:iam::424242:role/something"
handler = "main"
runtime = "go1.x"
source_code_hash = "${base64sha256(file("./check.zip"))}"
}
resource "aws_cloudwatch_event_rule" "every_twelve_hours" {
View dpgo.md

Design patterns with Go

Course Materials

  • Handouts / Worksheets
  • Slides
  • Code Examples
  • Videos

Course objectives

@groovili
groovili / singleton.go
Created Jul 6, 2018 — forked from jackypanster/singleton.go
singleton in golang
View singleton.go
package singleton
import (
"sync"
)
type singleton struct {
}
var instance *singleton
@groovili
groovili / latency.txt
Created Jul 3, 2018 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
View fake_web_crawler.go
package main
import (
"fmt"
"sync"
"time"
)
type Fetcher interface {
Fetch(url string) (body string, urls []string, err error)
View compare_binary_tree.go
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
func _walk(t *tree.Tree, ch chan int) {
if t == nil {
return
@groovili
groovili / git-tags-add-and-delete.sh
Last active May 12, 2018 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
View git-tags-add-and-delete.sh
# add tag
git tag 12345
# push tags to remote
git push --tags
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
@groovili
groovili / int_2_roman.php
Last active Dec 13, 2017
CLI script to convert integer to roman number
View int_2_roman.php
<?php
function getPeriod(int $int, int $n): int {
$m = '1';
$m .= str_repeat(0, $n);
return $int * ((int) $m);
}
function getRomanNumber(int $input): string{
View array_merge.php
<?php
function cm(array $ar1, array $ar2, int $rc = 0): array
{
$duplicatePositions = [];
$merged = [];
foreach($ar1 as $key => &$value){
if($dk = array_search($value, $ar2, true)){
$duplicatePositions[$dk] = $ar2[$dk];
You can’t perform that action at this time.