Skip to content

Instantly share code, notes, and snippets.

View muraray's full-sized avatar
🎯
Be Water, My Friend.

Murali Ramakrishnan muraray

🎯
Be Water, My Friend.
View GitHub Profile
@muraray
muraray / SQL Base64 Encoding
Created August 4, 2022 09:59
Base64 encoding schemes are commonly used when there is a need to encode binary data, especially when that data needs to be stored and transferred over media that are designed to deal with text. This encoding helps to ensure that the data remains intact without modification during transport. Base64 is used commonly in a number of applications in…
-- BTOA Encode the text string
SELECT CAST(N'' AS XML).value(
'xs:base64Binary(xs:hexBinary(sql:column("bin")))',
'VARCHAR(MAX)'
) Base64Encoding
FROM (
SELECT CAST('StoredValue=' + CAST(1213 as VARCHAR(30)) + '' AS VARBINARY(MAX)) AS BIN)
AS EncryptedStudentId;
-- ATOB Decode the Base64-encoded string
/// <summary>
/// ''' Class to Encrypt and Decrypt From APS previous Version.
/// </summary>
public sealed class EncryptDecrypt
{
private EncryptDecrypt()
{
}
// Encrypts specified plaintext using Rijndael symmetric key algorithm
@muraray
muraray / fabric-ui-react-parcel-bootstrap.md
Created February 15, 2020 02:31
Fabric-UI React Parcel Bootstrap

Fabric-UI React Parcel Bootstrap

A minimum viable Fabric-UI React app with Parcel Bundler

What's inside?

  • parcel-bundler
  • react
  • react-dom
  • office-ui-fabric-react
@muraray
muraray / iterm2-solarized.md
Created October 2, 2019 15:12 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@muraray
muraray / .babelrc
Last active October 8, 2018 07:03
React Rollup Bootstrap
{
"presets": [ "es2015-rollup", "react" ],
"plugins": [ "external-helpers", "transform-decorators-legacy" ]
}
@muraray
muraray / localstorage-actions.js
Last active September 14, 2018 04:56
How to Localstorage
const unique_incr = () =>
('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/1|0/g, function() {
return (0 | (Math.random() * 16)).toString(16)
})
const STORAGE_KEY = 'todos';
var fetch = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')
var save = todos => localStorage.setItem(STORAGE_KEY, JSON.stringify(todos))
var state = { todos: [] }
@muraray
muraray / Validate Singapore NRIC (as SQL Function)
Created August 29, 2018 09:32
Validate Singapore NRIC (as SQL Function)
GO
/****** Object: UserDefinedFunction [dbo].[ValidateNRIC] Script Date: 08/29/2018 5:24:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Murali, scanmurali@gmail.com>
-- Create date: <2018-04-28 17:30:50.723>
-- Description: <Function validates the supplied NRIC string>
@muraray
muraray / Fabric React Rollup Boilerplate
Last active September 7, 2018 09:52
Fabric React Rollup Boilerplate
# Boilerplate structure for React TypeScript and Rollup
A boilerplate to develop react apps and components with TypeScript and Rollup
## Getting Started
```bash
npm init -y
```
@muraray
muraray / gh-pages-deploy.md
Created February 21, 2018 11:21 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

function GenerateMAC(){
var hexDigits = "0123456789ABCDEF";
var macAdd = "";
for (var i = 0; i < 6; i++) {
macAdd += hexDigits.charAt(Math.round(Math.random() * 15));
macAdd += hexDigits.charAt(Math.round(Math.random() * 15));
if (i != 5) macAdd += ":";
}
return macAdd;