Skip to content

Instantly share code, notes, and snippets.

View tuommii's full-sized avatar

Miikka Tuominen tuommii

  • Helsinki, Finland
  • 18:10 (UTC +02:00)
View GitHub Profile
@tuommii
tuommii / devops-cheatsheet.md
Created August 4, 2020 15:18 — forked from pedrouid/devops-cheatsheet.md
Digital Ocean DevOps Cheatsheet (Ubuntu 16.04)

Digital Ocean DevOps Cheatsheet (Ubuntu 16.04)

How to Deploy a Node.js App with SSL

Create an SSH key

We will need this for our server configuration

  1. Open console
@tuommii
tuommii / golang_job_queue.md
Created June 28, 2020 11:02 — forked from harlow/golang_job_queue.md
Job queues in Golang
@tuommii
tuommii / GoConcurrency.md
Created June 10, 2020 19:03 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@tuommii
tuommii / linux_input.c
Created May 14, 2020 14:49 — forked from uobikiemukot/linux_input.c
test program of reading /dev/input/event*
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/input.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
@tuommii
tuommii / git-create.sh
Created July 24, 2019 13:43 — forked from rorlab/git-create.sh
Shell script for making github repository and pushing source codes
#!/bin/sh
repo_name=$1
test -z $repo_name && echo "Repo name required." 1>&2 && exit 1
curl -u '[username]:[password]' https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}"
git init
git add .
git commit -m "initial commit"
git remote add origin "https://github.com/[username]/$repo_name.git"
git push -u origin master
@tuommii
tuommii / .vimrc
Last active January 31, 2021 08:10
syntax on
set number
set noswapfile
set nocompatible
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set tabstop=4
@tuommii
tuommii / nginxproxy.md
Created April 13, 2018 12:10 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tuommii
tuommii / main.go
Created April 2, 2018 19:37 — forked from mschoebel/main.go
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
function laiska() {
git add -A
git commit -m "$1"
}
groupBy(data, unwindKey, calcKey) {
let output = {};
// function that we call each item in data
let sum = function(row, index) {
// if not found lets add it to output
if (!(row[unwindKey] in output)) {
output[row[unwindKey]] = row[calcKey];
}
// Muutoin lasketaan summa