Skip to content

Instantly share code, notes, and snippets.

@suryakun
suryakun / simple-map-reduce.ts
Created February 7, 2023 10:56
Simple map reduce
const arr : String[] = ["B$u$i$ld", "$t$$h$e", "N$e$x$t", "E$$ra", "$$o$f$", "S$$of$t$wa$r$e", "De$$ve$l$op$me$n$t"];
function buildTheSentence(arr: String[]) : String {
const result: String = arr
.map((str: String) => (str.match(/[a-zA-Z]/gm) || []).join(''))
.reduce((sentence: String, word : String) => sentence + " " + word )
return result;
}
console.log(buildTheSentence(arr))
@suryakun
suryakun / simple-terraform-ec2-setup
Created October 10, 2021 15:30
Simple Terraform EC2 setup
provider "aws" {
region = "ap-southeast-1"
}
variable "ingress" {
type = list(number)
default = [80, 433, 22]
}
variable "egress" {
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
git remote rm origin
git remote add origin https://[APPLICATION]:[NEW TOKEN]@github.com/[ORGANISATION]/[REPO].git
@suryakun
suryakun / error android licence flutter.txt
Last active October 17, 2018 16:44
Install Flutter : ✗ Android license status unknown.
flutter doctor --android-licenses
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
/home/surya/Android/Sdk/tools/bin/sdkmanager --update
flutter doctor --android-licenses
Y
@suryakun
suryakun / install_elixir.md
Created June 7, 2018 22:00 — forked from rubencaro/install_elixir.md
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

@suryakun
suryakun / macros.md
Created February 18, 2018 15:09 — forked from jessejanderson/macros.md
Don't Write Macros (but do learn how they work)
@suryakun
suryakun / tmux-cheatsheet.markdown
Created January 6, 2018 04:57 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@suryakun
suryakun / recreate-docker-compose
Created January 1, 2018 13:11
Recreate force docker-compose container
docker-compose rm -f
docker-compose pull
docker-compose up --build -d
FROM elixir:latest
WORKDIR /usr/src
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash -
RUN apt-get install -y nodejs && apt-get install -y inotify-tools
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez