Skip to content

Instantly share code, notes, and snippets.

Jimmy Chandra jchandra74

  • Sydney, NSW, Australia
Block or report user

Report or block jchandra74

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
@jchandra74
jchandra74 / openssl.MD
Last active Oct 15, 2019
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window
View openssl.MD

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.

Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:

Self-Signed SSL Issue in Chrome

View Guid Generator PowerShell.md

PowerShell GUID Generator

From time to time, I need to generate GUID to be used as Unique Id for whatever reason. When I have Visual Studio opened, I usually use the GUID tool that comes with it.

But sometimes I am developing in VS Code and opening Visual Studio just to get access to the GUID tool is a pain.

So why not add the functionality to PowerShell instead? You can have PowerShell available from inside VS Code Terminal. It's the perfect thing to add.

So how do we go about that?

@jchandra74
jchandra74 / PowerShell Customization.md
Last active Oct 18, 2019
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization
View PowerShell Customization.md

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@jchandra74
jchandra74 / NullifyEmptyProperties.cs
Created Sep 7, 2016
Object graph walker that will clean up empty array, generic collection and string
View NullifyEmptyProperties.cs
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Foo
{
public static class ObjectExtensions
{
public static void NullifyEmptyProperties(this object o)
{
@jchandra74
jchandra74 / index.html
Last active Apr 2, 2016
Angular Speech API Times Table Quiz for Kids
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container" ng-app="app" ng-controller="pageCtrl as page">
@jchandra74
jchandra74 / FileUtil.cs
Last active Aug 29, 2015
Detect MimeType and File Extension based on filename and falling back to fileStream for signature detection (specific to .binary extension)
View FileUtil.cs
//mimetypes: http://www.sitepoint.com/web-foundations/mime-types-complete-list/
//https://technet.microsoft.com/en-us/library/ee309278(office.12).aspx
public static class FileUtil
{
public static string DetectFileType(string filename, Stream fileStream)
{
var ext = Path.GetExtension(filename);
if (string.IsNullOrEmpty(ext))
{
@jchandra74
jchandra74 / SHA1Util.cs
Last active Apr 3, 2019 — forked from kristopherjohnson/SHA1Util.cs
SHA1 Hash for Unicode string
View SHA1Util.cs
//Forked from kristopherjohnson/SHA1Util.cs gist
using System.Security.Cryptography;
using System.Text;
namespace Snippets
{
public static class SHA1Util
{
/// <summary>
/// Compute hash for string encoded as UTF8
@jchandra74
jchandra74 / binary2hex.cs
Created Apr 14, 2015
Binary to Hex String Conversion
View binary2hex.cs
public static string BinaryToHex(byte[] data)
{
if (data == null)
{
return null;
}
var array = new char[checked(data.Length*2)];
for (var i = 0; i < data.Length; i++)
{
View StringExtension.cs
namespace __NAMESPACE__
{
using System.Text;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
public static class StringExtension
{
public static string StripInvalidUnicodeCharacters(this string str)
{
View ObjectSerializer.cs
namespace __NAMESPACE__
{
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using Newtonsoft.Json;
using JsonSerializer = ServiceStack.Text.JsonSerializer;
using XmlSerializer = System.Xml.Serialization.XmlSerializer;
You can’t perform that action at this time.