Skip to content

Instantly share code, notes, and snippets.

View dejanstojanovic's full-sized avatar
🎧
Focusing

Dejan Stojanovic dejanstojanovic

🎧
Focusing
View GitHub Profile
docker run -d --rm --name local-rabbitmq -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
docker exec local-rabbitmq rabbitmq-plugins enable rabbitmq_management
docker exec local-rabbitmq rabbitmq-plugins enable rabbitmq_shovel
docker exec local-rabbitmq rabbitmq-plugins enable rabbitmq_shovel_management
docker exec local-rabbitmq rabbitmqctl add_user myuser mypass
docker exec local-rabbitmq rabbitmqctl set_user_tags myuser administrator
docker exec local-rabbitmq rabbitmqctl add_vhost myapphost
docker exec local-rabbitmq rabbitmqctl set_permissions --vhost "myapphost" myapp ".*" ".*" ".*"
@dejanstojanovic
dejanstojanovic / Local-Kubernetes.md
Created September 28, 2021 06:03 — forked from dahlsailrunner/Local-Kubernetes.md
Helpful tips and snippets for Kubernetes within Docker Desktop

Using the K8s Dashboard Locally

Actual repo is here: https://github.com/kubernetes/dashboard

1. Install the Dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.1.0/aio/deploy/recommended.yaml

2. Create a Sample User Account that can Access the Dashboard via Token

kubectl apply -f https://gist.githubusercontent.com/dahlsailrunner/bbd453f3bb6259b66c08a70d0908283f/raw/5727723217e2df4b65d8933adf04d009cfb0fe3f/local-dashboard-account.yml
@dejanstojanovic
dejanstojanovic / install-kubernetes-on-buster.sh
Created June 12, 2021 06:41 — forked from BeerOnBeard/install-kubernetes-on-buster.sh
Set up a single-node Kubernetes system on Debian 10 (Bustomer). Use Flannel as the network fabric. Install the Kubernetes dashboard.
#!/bin/bash
set -e;
# Set up a single-node Kubernetes system on Debian 10 (Buster).
# Use Flannel as the network fabric. Install the Kubernetes
# dashboard.
# disable swap
swapoff -a;
@dejanstojanovic
dejanstojanovic / html5.localstorage.ex.js
Created October 28, 2018 11:08
HTML5 localStorage with expire
var localStorageEx = {
get: function (key) {
var value = localStorage[key];
if (value != null) {
var model = JSON.parse(value);
if (model.payload != null && model.expiry != null) {
var now = new Date();
if (now > Date.parse(model.expiry)) {
localStorage.removeItem(key);
return null;
using System.IO;
namespace IOExtensions
{
public static class DirectoryExtensions
{
public static bool IsHidden(this DirectoryInfo dir)
{
return (dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
}
@dejanstojanovic
dejanstojanovic / k8-service
Created September 6, 2018 10:15
k8 service commands and config
=================== M6-03
### Wrapping the hello-rc Replication Controller in a Service - the iterative way
$ kubectl expose rc hello-rc --name=hello.svc --target-port=800 --type=NodePort
$ kubectl describe svc hello-svc
=================== M6-04
### Wrapping the hello-rc Replication Controller in a Service - the iterative way
@dejanstojanovic
dejanstojanovic / k8-deployment
Created September 6, 2018 10:14
k8 deployment config and commands
#### m7-03
kubectl delete rc hello-rc
kubectl get pods
kubectl describe svc hello-svc
vim deploy.yml
kubectl create deployment
@dejanstojanovic
dejanstojanovic / read-file-lines.sh
Created August 28, 2018 08:35
Read text file line by line via bash
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
echo $line
done < "$1"
[
{
"Windows": "Dateline Standard Time",
"Linux": "Etc/GMT+12"
},
{
"Windows": "UTC-11",
"Linux": "Etc/GMT+11"
},
{
var today = new Date();
var todayUtc = new Date(today.getUTCFullYear(),today.getUTCMonth(),today.getUTCDay(),today.getUTCHours(),today.getUTCMinutes(),today.getUTCSeconds(), today.getUTCMilliseconds());
console.log(today.toString());
console.log(todayUtc.toString());