This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=================== 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### m7-03 | |
kubectl delete rc hello-rc | |
kubectl get pods | |
kubectl describe svc hello-svc | |
vim deploy.yml | |
kubectl create deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
echo $line | |
done < "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#unzip -> https://stackoverflow.com/questions/27768303/how-to-unzip-a-file-in-powershell | |
#check -> http://geekswithblogs.net/QuandaryPhase/archive/2013/02/24/create-iis-app-pool-and-site-with-windows-powershell.aspx | |
#check -> https://docs.microsoft.com/en-us/iis/manage/powershell/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools | |
# 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 http://ifrahimblog.wordpress.com/2014/02/26/run-powershell-elevated-permissions-import-iis-module/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install espeak | |
sudo apt-get install espeak | |
# install mbrola | |
wget http://tcts.fpms.ac.be/synthesis/mbrola/bin/raspberri_pi/mbrola.tgz | |
tar xvzf mbrola.tgz | |
chmod 755 mbrola | |
sudo mv ./mbrola /usr/local/bin/ | |
# install voices for mbrola |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<TSource> DistinctBy<TSource, TKey> (this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
HashSet<TKey> seenKeys = new HashSet<TKey>(); | |
foreach (TSource element in source) | |
{ | |
if (seenKeys.Add(keySelector(element))) | |
{ | |
yield return element; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.zip.GZIPInputStream; | |
import java.util.zip.GZIPOutputStream; | |
public class Gzip { |