Skip to content

Instantly share code, notes, and snippets.

View TeemuKoivisto's full-sized avatar

Teemu Koivisto TeemuKoivisto

View GitHub Profile
@TeemuKoivisto
TeemuKoivisto / aws.sh
Last active September 7, 2023 16:57
Installs AWS CLI v2 with Bash for Linux x86 / ARM
#!/usr/bin/env bash
# or for alpine #!/bin/sh
########################################################
# Installs AWS CLI v2 https://docs.aws.amazon.com/cli/ #
########################################################
# Needs curl or wget and unzip installed
# If you are using Alpine, you should use apk directly (because reasons https://github.com/aws/aws-cli/issues/4971)
# apk add aws-cli=2.13.5-r0
@TeemuKoivisto
TeemuKoivisto / ext
Last active November 30, 2022 15:43
https://drive.google.com/file/d/14heSnXHGXAM7KSrN3rLpdU3DTpX1554w/view?usp=sharing
https://drive.google.com/file/d/1aVV1PmguPnJRVMAdp33F-1jgC07VYRXc/view?usp=sharing
https://drive.google.com/file/d/1ndclz_UZi7NuiNbSmT_AmLyC9m2qUvJZ/view?usp=sharing
https://drive.google.com/file/d/1tMIDjYAgS4d1EQHs54rP8MaIhLbe0yXy/view?usp=sharing
@TeemuKoivisto
TeemuKoivisto / db-migrate.yml
Created May 10, 2022 06:06
Github action to migrate Postgres DB in Heroku with pnpm and Prisma
name: Migrate Heroku DB
on:
push:
branches:
- main
workflow_dispatch:
inputs:
run_seed:
description: 'Run post migrate operation: <none> | seed'
@TeemuKoivisto
TeemuKoivisto / onNavigation.ts
Last active October 6, 2021 08:43
Very rough hack to prevent navigation in SvelteKit
let currentLocation = ''
/**
* Usage:
* @example
* import { onDestroy, onMount } from 'svelte'
* import { onNavigation } from '$utils/onNavigation'
*
* let offNavigation: () => void
@TeemuKoivisto
TeemuKoivisto / Editor.tsx
Last active January 22, 2024 14:04 — forked from esmevane/index.tsx
Updated ProseMirror + React example with TypeScript and styled-components from @esmevane using NodeViews
import * as React from 'react'
import ReactDOM from 'react-dom'
import { EditorState } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'
import { Node, Schema } from 'prosemirror-model'
import applyDevTools from 'prosemirror-dev-tools'
import styled from 'styled-components'
// Here we have the (too simple) React component which
// we'll be rendering content into.
@TeemuKoivisto
TeemuKoivisto / Editor.tsx
Last active June 24, 2019 12:23
Updated ProseMirror + React example with TypeScript and styled-components from @esmevane https://gist.github.com/esmevane/7326b19e20a5670954b51ea8618d096d
import * as React from 'react'
import ReactDOM from 'react-dom'
import { EditorState } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'
import { Node, Schema } from 'prosemirror-model'
import applyDevTools from 'prosemirror-dev-tools'
import styled from 'styled-components'
// Here we have the (too simple) React component which
// we'll be rendering content into.
from pyspark import SparkContext, SparkConf
import os
import sys
#datasets path on shared group directory on Ukko2. Uncomment the one which you would like to work on.
dataset = "/proj/group/distributed-data-infra/data-1-sample.txt"
#dataset = "/proj/group/distributed-data-infra/data-1.txt"
#dataset = "/proj/group/distributed-data-infra/data-2-sample.txt"
#dataset = "/proj/group/distributed-data-infra/data-2.txt"
@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
@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 / 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.