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',
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));
}
@loctanvo
loctanvo / .gitconfig-aliases
Created September 28, 2015 07:47 — forked from jstclair/.gitconfig-aliases
Git aliases
[alias]
# common aliases - acquired from many places...
# operations
b = branch
cl = clone
ci = commit
amend = commit --amend --no-edit
st = status --short --branch
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;
@loctanvo
loctanvo / Delete merged branches
Created February 10, 2015 09:07
Delete merged branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d