Skip to content

Instantly share code, notes, and snippets.

View TeemuKoivisto's full-sized avatar

Teemu Koivisto TeemuKoivisto

View GitHub Profile
@TeemuKoivisto
TeemuKoivisto / users-ohjeet.md
Last active March 27, 2019 14:36
Noden asennus users-palvelimelle

Node serverin asennus users-palvelimelle

Tai samaa ohjetta hivenen modifioimalla minkä tahansa muun palvelimen johon ei tarvita sudo-oikeuksia; RoRin, Djangon tai vaikka Go:n. Huomioitavana on vain users-palvelimen vanha käyttöjärjestelmä: Ubuntu 10.04 joka ei välttämättä kaikkea pyöritä ilman ainakaan ongelmia.

  1. Ota ssh-yhteys users-palvelimelle esim. ssh TUNNUS@users.cs.helsinki.fi jossa TUNNUS on ad-tunnuksesi
  2. Suorita wanna-htdocs jos sinulle ei ole jo Apachee asennettuna ja htdocs kansiota
  3. Luo Apachen konfiguraatio tiedosto .htaccess touch ~/htdocs/.htaccess
  4. Lisää siihen rivit:
RewriteEngine On

Installing Docker on Windows

Follow the basic setup as in the Docker website. For me I had to download the Docker toolchain from here 🔗.

After that you should have docker installed and the Docker terminal ready to be opened from your desktop.

I followed the instructions from here https://nodejs.org/en/docs/guides/nodejs-docker-webapp/ to create my first Docker container with Node.js. Here's the short and sweet if you want just to copy and paste to see if it works: NOTE! On Windows or MacOS machines you cannot go straight to the localhost:49160 to see the app working. As explained here moby/moby#15740 they cannot run the Docker container natively so the port is actually the one on the VirtualBox so for me worked just write docker-machine ip default and whatever the ip from that is your container's ip. (my app was on http://192.168.99.100:49160/)

@TeemuKoivisto
TeemuKoivisto / typescript.md
Last active April 22, 2017 15:11
How to create a simple TypeScript app that is compiled into frontend library

Beginning

A short tutorial on how to create a basic TypeScript app for a game or another project targeted on frontend.

1. Setting up the project

Create a new folder for your project and cd there and type npm init to create package.json. Writer whatever you want there or just hit enter to each and then let's install typescript: npm i -S typescript. We could install it also globally for some ease of use BUT to me installing global dependencies are annoying so for now let's withold from doing so.

Instead let's add tsconfig.json manually to the root of our folder. This would be created with tsc --init but since we are now very stupid we'll do it manually. Copy & paste this inside of it:

@TeemuKoivisto
TeemuKoivisto / kirjanpito.md
Last active May 26, 2017 23:29
tuntikirjanpito-react-2017
  • 8.5 ma 4h projektin bootstrappaus create-react-appilla + sw-precachella
  • 10.5 ke 4h redux-saga
  • 12.5 pe 7h redux immutable setup ja opiskelua
  • 13.5 la 9h react-router v4 opiskelua ym
  • 14.5 su 9h service worker opiskelua, react bootstrap, font-awesome
  • 27.5 su 2h refresh ikonin säätämistä + react-router
@TeemuKoivisto
TeemuKoivisto / travis-s3-guide.md
Last active May 27, 2017 19:54
Guide to hosting static website to AWS S3

How to host a website on S3

S3 is a cheap way to host static files and pretty easy too (when you know how to do it)

What you need to have in order to do it:

  1. AWS account, you can get one through GitHub education > AWS education to get free credit
  2. Travis account (pretty straightforward, just log in with your GitHub account to create it)
  3. 10 minutes

Okey, you're all set. Let's go.

@TeemuKoivisto
TeemuKoivisto / go-helloworld-guide.md
Last active May 29, 2017 10:35
Guide to starting up a Go project

How to start a Go project on Mac OS and deploy it to Heroku

What you need:

  1. Travis account (just log in with your GitHub credentials to create one)
  2. Heroku account
  3. Heroku CLI (brew install heroku)
  4. Travis CLI (gem install travis)

Let's start:

@TeemuKoivisto
TeemuKoivisto / .htaccess
Created May 28, 2017 13:40
users htaccess
RewriteEngine On
# tsekkaa onko polku jo turvattu eli https:n ylitse
RewriteCond %{HTTPS} !=on
# jos ei niin uudelleen ohjaa https-polkuun R=redirect L=last eli lopettaa suorittamisen tähän sääntöön
RewriteRule ^/?(.*) https://teekoivi.users.cs.helsinki.fi/$1 [R,L]
# polku on nyt https:ssä joten voimme proxata sen taustalla pyörivälle node-prosessille
@TeemuKoivisto
TeemuKoivisto / grappa-checklist.md
Last active June 6, 2017 08:44
Miten grappaa voisi parantaa tekin osalta

Grappa checklist

  • Päivittää riippuvuudet ois kiva, webpack 1->2 rikkoo jotain niin jäi se siihen sillon joskus
  • Tai suoraan vaihtaa create-react-app:iin. Sillä pystyy helposti päivittämään riippuuvuksia
  • React koodi uudella rakenteella. Vanhakin on toiminut mutta ois ehk parempi laittaa tietyntyyppiset omiin kansioihin -> reducers, actions yms.
  • Vaihda API-middleware hässäkkä & redux-thunk redux-sagaan. On vaan parempi
  • Poista turha koodi. Heh
  • Poista/korjaa testit
  • Dokumentaatio
  • AUTOMAATTINEN BUILDI SUORAAN PALVELIMELLE. Aika must jos aiotaan käyttää Grappaa monessa paikkaa ja hallinnoida niitä päivityksiä jotenkin.
@TeemuKoivisto
TeemuKoivisto / travis-elasticbeanstalk.md
Last active June 1, 2017 13:36
Guide to hosting a Node.js application on Elastic Beanstalk

How to setup Elastic Beanstalk pipelinen with Node.js, Travis and GitHub

  1. First create sample Elastic Beanstalk application from the AWS console.
  2. Then create IAM group and user with policy set to AWSElasticBeanstalkFullAccess.
  3. Copy the user Access Key Id and secret somewhere safe.
  4. Create a new project folder where you create your Node-app. Here's a premade setup if you are lazy: https://github.com/TeemuKoivisto/travis-aws-node
  5. Remember to add npm start script!
  6. Setup travis yml with travis init and travis setup elastic-beanstalk. Paste your access key and secret when prompted. You can use my project's .travis.yml as a guide.
  7. Since travis is stupid and can't actually properly setup your project you have to add manually bucket_name underneath deploy in your .travis.yml.
  8. Elastic Beanstalk already generated you a S3 bucket which name you should paste eg. bucket_name: "elasticbeanstalk-us-west-2-014750007983"
@TeemuKoivisto
TeemuKoivisto / HADOOP-ON-K8S.md
Last active December 1, 2022 12:21
How to install Hadoop to your local Kubernetes cluster

How to install Hadoop on your local Kubernetes cluster

Okey this is not the easiest way of running Hadoop on your local computer and probably you should instead just install it locally.

However if you really insist doing this here's how:

  1. Install kubectl, minikube and Docker if you don't already have it. I recommend using package-manager like Chocolatey. Minikube should install with VirtualBox as default driver which I recommend. When starting minikube we should increase its memory limit since our Hadoop node's pods need at least 2GB: minikube --memory 4096 --cpus 2 start (minikube's default is 1GB). NOTE: actually the Hadoop cluster by default uses about 10GB in memory limits and about 3GB running memory. From what I looked my k8s will overprovision to 300% of its capacity limits but use far less.
  2. Install helm. Then run helm init.
  3. Now you