Skip to content

Instantly share code, notes, and snippets.

Avatar
🍺
beerstorm

Yilmaz Guleryuz zeusbaba

🍺
beerstorm
View GitHub Profile
@zeusbaba
zeusbaba / firestore-export.js
Last active Sep 19, 2020
export Firestore collection into json file
View firestore-export.js
/*
Requirements:
1) To be able to access your Firestore collections, you must have serviceAccountKey.json ,
You can generate it
- via Firebase Project Overview -> Settings -> Service accounts
- Generate new private key, then download it as codementorship_serviceAccountKey.json file.
Put this file in the same folder as this script.
2) use this js file (firestore-export.js) as part of basic node.js project,
and with a simple package.json that contains the following deps
@zeusbaba
zeusbaba / cloud-function_db-to-firestore.js
Last active Aug 17, 2020
Example cloud function that handles processing Firebase DB data into Firestore
View cloud-function_db-to-firestore.js
//this cloud function listens to new records,
// then process them to create models aligned with App logic which is using Firestore.
function firestoreRecord_parkingnorway(dbRecord) {
let firestoreRecord = {};
// this method creates a mapped version according to app logic
// etc etc etc ....
return firestoreRecord;
@zeusbaba
zeusbaba / do-k8s-traefik.yaml
Last active Oct 2, 2020
Helm config for Traefik in DO-k8s
View do-k8s-traefik.yaml
image: traefik
imageTag: 1.7.12
# NB! this creates DO's auto-assigned load balancer
serviceType: LoadBalancer
## NB! if you don't use LoadBalancer, uncomment this other alternative
#serviceType: NodePort
# floating-ip from DO which you assigned to k8s cluster
#externalIP: 123.123.123.123
@zeusbaba
zeusbaba / do-k8s-helm
Last active Oct 1, 2019
Helm in DO-k8s
View do-k8s-helm
# install Helm, see https://helm.sh
# get the installer script
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > helm-install.sh
chmod u+x helm-install.sh
# IF you want to install latest 'stable' version
./helm-install.sh
# IF you want to install a specific version, f.eks. in-dev version
@zeusbaba
zeusbaba / do-k8s-monitoring
Created Aug 25, 2019
monitoring on DO-k8s
View do-k8s-monitoring
# prometheus-operator see -> https://github.com/coreos/prometheus-operator/
```
wget https://github.com/coreos/prometheus-operator/raw/master/bundle.yaml
mv bundle.yaml prometheus-operator-bundle.yaml
$kubectl apply -f prometheus-operator-bundle.yaml
```
# metrics-server
```
$ git clone https://github.com/kubernetes-incubator/metrics-server
@zeusbaba
zeusbaba / do-k8s-dashboard
Created Aug 25, 2019
web-ui-dashboard on DO-k8s cluster
View do-k8s-dashboard
# deploy the latest dashboard, v2-beta3
$kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta3/aio/deploy/recommended.yaml
# for accessing it, you need to
$kubectl proxy
# now it is accessible via
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
# NB! if you get default is not accessible error in dashboard, then create 'default' namespace with
@zeusbaba
zeusbaba / do-kubectl
Last active Aug 25, 2019
shortcut kubectl for DO-kubeconfig
View do-kubectl
vim ~/.bash_profile
# put this in your bash_profile, NB! use your own path+name for your DO-kubeconfig file
export KUBECONFIG=/FIXME/kubeconfigs/petcat-k8s-kubeconfig.yaml
export kubectl="kubectl --kubeconfig=$KUBECONFIG"
# then run this to make it active
source bash_profile
# now you can start using kubectl with DO kubeconfig with this shotcut cmd
$kubectl
View keybase.md

Keybase proof

I hereby claim:

  • I am zeusbaba on github.
  • I am zeusbaba (https://keybase.io/zeusbaba) on keybase.
  • I have a public key whose fingerprint is 4043 C3F6 5816 E201 6F92 5803 7399 69A2 6866 E8CE

To claim this, I am signing this object:

@zeusbaba
zeusbaba / localStorage.js
Last active May 11, 2018
abstraction functions for using window.localStorage via store.js
View localStorage.js
// --- abstraction funcs for using LocalStorage via https://github.com/marcuswestin/store.js/ ---
var base_url = window.location.protocol + '//' + window.location.hostname;
var appConfig = {
duration: {
expiry: 3 * 60 *1000, // session-expiry period
warning: 1 * 60 * 1000, // duration before displaying popup
idle: 1 * 60 * 1000, // IDLE if user stays idle for this period
checker: 42*1000, // periodic duration used by timeoutChecker
@zeusbaba
zeusbaba / using-chromium-for-local-dev.txt
Last active Nov 24, 2017
using-chromium-for-local-dev
View using-chromium-for-local-dev.txt
>> installing & using CHROMIUM <<
- download CHROMIUM from https://www.chromium.org/Home
- how to run it with custom params, see here:
https://stackoverflow.com/a/42024918/492918
- and here is an example that disables CORS, local security validation, etc
chromium.exe --args --disable-web-security --user-data-dir --allow-insecure-localhost