Skip to content

Instantly share code, notes, and snippets.

View TeemuKoivisto's full-sized avatar

Teemu Koivisto TeemuKoivisto

View GitHub Profile
@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 / 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 / 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 / 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 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.
@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
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 / 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.