Skip to content

Instantly share code, notes, and snippets.

View NorikDavtian's full-sized avatar
🚢
Shipping

Norik Davtian NorikDavtian

🚢
Shipping
View GitHub Profile
@NorikDavtian
NorikDavtian / learn-go-lang-expedited.md
Last active August 7, 2020 05:48
My take on learning Go Language. https://git.io/fhLYE

Learn Go Lang: Expedited

This is my take on learning go and experimenting with it, again.
Learning a new language is often times a lot of back and forth between I got it and hmm what's next?
It is easy to get started but what is past the hello-word.go?
Is it a web server or is it a cli tool?
This is the never ending loop of being stuck on more hello world examples and more CRUD using different frameworks that I dont intend to use.
Sometimes it is difficult to do paradigm switching, but a working playground environment will make it easy to get it going and not get stuck. I hit my own share of roadblocks trying to learn go, hopefully this list will make it easy for someone else.

Let's not get stuck and get it going :)

# https://kubernetes.io/docs/reference/kubectl/cheatsheet/#zsh
source <(kubectl completion zsh) # setup autocomplete in zsh into the current shell
echo "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> ~/.zshrc # add autocomplete permanently to your zsh shell
FROM alpine
RUN apk update && apk upgrade
RUN apk add nodejs
WORKDIR /app
ADD . /app
ENTRYPOINT [ "node", "server.js" ]
@NorikDavtian
NorikDavtian / random-string.js
Created July 22, 2018 07:35
Generate random string
/**
* From https://github.com/spotify/web-api-auth-examples/blob/master/authorization_code/app.js#L25-L33
* Generates a random string containing numbers and letters
* @param {number} length The length of the string
* @return {string} The generated string
*/
var generateRandomString = function(length) {
var text = '';
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
# https://hub.docker.com/_/alpine/
docker pull alpine
# bind the volume to your container
docker run -v "$(pwd)/micro-service":/micro-service -it alpine

Udacity K8s course notes

https://classroom.udacity.com/courses/ud615/lessons/7826112332/concepts/81473137730923

Download Go:

Note: Cloud Shell comes with an installed Go, but it's not the most recent version, so you should perform the steps below to install the latest Go and set GOPATH.

wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz
echo "export GOPATH=~/go" &gt;&gt; ~/.bashrc
@NorikDavtian
NorikDavtian / jsonl-to-multiple-json-files.js
Created November 20, 2017 10:08
Small handy utility script to break large jsonl files to smaller json files.
// COUNT=3 INPUT=large_file.jsonl node jsonl-to-multiple-json-files.js
const fs = require('fs');
const readline = require('readline');
const COUNT = parseInt(process.env.COUNT); // Numer of lines to get from the large file
const input = fs.createReadStream(process.env.INPUT.toString()); // input .jsonl file
const rl = readline.createInterface({ input });
let counter = 0;
rl.on('line', (line) => {