Skip to content

Instantly share code, notes, and snippets.


Dejan Stojanovic dejanstojanovic

Block or report user

Report or block dejanstojanovic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dejanstojanovic / html5.localstorage.ex.js
Created Oct 28, 2018
HTML5 localStorage with expire
View html5.localstorage.ex.js
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)) {
return null;
View DirectoryExtensionss.cs
using System.IO;
namespace IOExtensions
public static class DirectoryExtensions
public static bool IsHidden(this DirectoryInfo dir)
return (dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
dejanstojanovic / k8-service
Created Sep 6, 2018
k8 service commands and config
View k8-service
=================== 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 / k8-deployment
Created Sep 6, 2018
k8 deployment config and commands
View k8-deployment
#### m7-03
kubectl delete rc hello-rc
kubectl get pods
kubectl describe svc hello-svc
vim deploy.yml
kubectl create deployment
dejanstojanovic /
Created Aug 28, 2018
Read text file line by line via bash
while IFS='' read -r line || [[ -n "$line" ]]; do
echo $line
done < "$1"
View Windows-Linux-TimeZone.json
"Windows": "Dateline Standard Time",
"Linux": "Etc/GMT+12"
"Windows": "UTC-11",
"Linux": "Etc/GMT+11"
View JavaScriptUtc.js
var today = new Date();
var todayUtc = new Date(today.getUTCFullYear(),today.getUTCMonth(),today.getUTCDay(),today.getUTCHours(),today.getUTCMinutes(),today.getUTCSeconds(), today.getUTCMilliseconds());
View StackExchange.Redis-ExpiryCounters.cs
class Program
static ConnectionMultiplexer redisConnection = ConnectionMultiplexer.Connect("<REDIS connection string>");
static void Main(string[] args)
var key = "counter.test";
var expiry = TimeSpan.FromMinutes(5);
IDatabase db = redisConnection.GetDatabase(3);
var count = db.StringIncrement(key, 1);
dejanstojanovic / CreateIISSite
Last active Jan 16, 2018 — forked from ifrahim/CreateIISSite
Create IIS Site using Powershell
View CreateIISSite
#unzip ->
#check ->
#check ->
# The following code will create an IIS site and it associated Application Pool.
# Please note that you will be required to run PS with elevated permissions.
# Visit
dejanstojanovic /
Last active Oct 12, 2017 — forked from sourceperl/
Text to speak software with espeak and mbrola for Raspberry Pi2 (under Raspbian/jessie)
# install espeak
sudo apt-get install espeak
# install mbrola
tar xvzf mbrola.tgz
chmod 755 mbrola
sudo mv ./mbrola /usr/local/bin/
# install voices for mbrola
You can’t perform that action at this time.