Skip to content

Instantly share code, notes, and snippets.

function New-GeneratedPwd {
$bytes = New-Object "System.Byte[]" 32
$rnd = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
$rnd.GetBytes($bytes)
[Convert]::ToBase64String($bytes)
}
@loctanvo
loctanvo / .hyper.js
Last active September 12, 2019 06:58
Configuration file for Hyper and hyper-snazzy theme. Modified split pane divider color.
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
# Nginx proxy for Elasticsearch + Kibana
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
# http://FQDN:9200
server {
listen *:80 ;
server_name kibana.myhost.org;
access_log /var/log/nginx/kibana.myhost.org.access.log;
@loctanvo
loctanvo / counties_Norway
Last active December 27, 2015 09:19
Counties of Norway. Contribution to countriesfor.us . Sources: http://snl.no/fylker_i_Norge http://en.wikipedia.org/wiki/Counties_of_Norway [Note: iso-code 13 is not in use]
var no = [
'Østfold',
'Akershus',
'Oslo',
'Hedmark',
'Oppland',
'Buskerud',
'Vestfold',
'Telemark',
'Aust-Agder',
public class TokenService
{
public static IEnumerable<Claim> ValidateAndParseToClaims(string token, string validAudience)
{
var parameters = CreateTokenValidationParameters(validAudience);
SecurityToken jwt;
var principal = new JwtSecurityTokenHandler().ValidateToken(token, parameters, out jwt);
return principal.Claims;
using System;
using System.Linq;
using System.Threading;
namespace MathRandom
{
class Program
{
static void Main()
{
using System;
using System.Linq;
using System.Threading;
namespace MathRandom
{
class Program
{
static void Main()
{
using System;
using System.Linq;
namespace MathRandom
{
class Program
{
static void Main()
{
var random1 = new Random();
using System;
using System.Globalization;
namespace MathRound.Demo
{
class Program
{
static void Main()
{
Console.WriteLine("Math.Round(x, MidpointRounding.AwayFromZero)");
class Program
{
static void Main()
{
Console.WriteLine("Default Math.Round(x)");
Console.WriteLine(Round(1.5));
Console.WriteLine(Round(2.5));
Console.WriteLine(Round(3.5));
}