Skip to content

Instantly share code, notes, and snippets.

Michael J. Ryan tracker1

Block or report user

Report or block tracker1

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
@tracker1
tracker1 / CustomJsonData.md
Created Aug 1, 2019
Custom encoded data into JSON
View CustomJsonData.md

For encoding custom/complex data in JSON for generic detection, I suggest the following methodology.

// USE ASCII Characters for kind of what they are meant for.
const DLE = String.fromCharCode(16); // Data Link Escape
const SOH = String.fromCharCode(1); // start of heading
const STX = String.fromCharCode(2); // start ot text
const ETX = String.fromCharCode(3); // end of text
const EOT = String.fromCharCode(4); // end of transmission
View Snackbar.component.jsx
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import { SnackbarProvider, withSnackbar } from 'notistack';
import CheckIcon from 'mdi-material-ui/Check';
import ErrorIcon from '@material-ui/icons/Error';
import ThumbUpIcon from '@material-ui/icons/ThumbUp';
import WarningIcon from '@material-ui/icons/Warning';
@tracker1
tracker1 / create-docker-sql.js
Created Jun 20, 2019
SQL in Docker via Node
View create-docker-sql.js
import { Docker } from "docker-cli-js";
import path from "path";
import shell from "shelljs";
import mkdirp from "mkdirp";
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
const isWin = process.platform === "win32";
const docker = new Docker();
const exec = str => {
View init-environment.js
import os from 'os';
import path from 'path';
const COMPANY = 'companydir';
const APP = 'appdir';
export const getDefaultDataPath = (env = process.env, useOS = os.platform()) => {
switch (useOS) {
case 'win32':
return path.join(env.PROGRAMDATA || 'C:/ProgramData', `${COMPANY}/${APP}/`);
@tracker1
tracker1 / request.js
Created Apr 5, 2019
fetch api wrapper - request
View request.js
import changeObjectCase from 'change-object-case';
import base from '../../base';
import HttpStatus from 'http-status-codes';
const serverCase = input =>
changeObjectCase.pascalKeys(input, { recursive: true, arrayRecursive: true });
export const headRequest = async route => {
const token = sessionStorage.getItem('token');
const headers = {
@tracker1
tracker1 / password-breached.js
Last active Apr 2, 2019
Check haveibeenpwned with JS
View password-breached.js
import crypto from 'crypto';
import fetch from 'node-fetch';
const PREFIX_LENGTH = 5;
export function hash(passphrase) {
const shaSum = crypto.createHash('sha1');
shaSum.update(String(passphrase).normalize('NFKC'));
return shaSum.digest('hex');
}
@tracker1
tracker1 / Docker on Windows Server 2019 Directions.md
Last active Mar 8, 2019
Docker on Windows Server 2019 for linux and windows containers
View Docker on Windows Server 2019 Directions.md

POWERSHELL: (Admin)

Install-WindowsFeature Hyper-V
Install-WindowsFeature Containers

mkdir "$Env:ProgramFiles\Docker"

cd "$Env:ProgramFiles\Docker"
@tracker1
tracker1 / MyComponent.jsx
Last active Jul 8, 2019
Simple pattern for loading async data with react, redux and redux-thunk middleware
View MyComponent.jsx
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import * as Actions from './action';
const mapStateToProps = ({ loaded, loading, error, data }) = ({ loaded, loading, error, data });
const mapDispatchToProps = dispatch => ({ action: bindActionCreators(Actions, dispatch) });
export class MyComponent extends Component {
load = _ => this.props.action.load(this.props.id);
@tracker1
tracker1 / .editorconfig
Created Jan 28, 2019
.gitignore for .Net + Node
View .editorconfig
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
# All files
[*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
# Xml files
@tracker1
tracker1 / Extensions
Created Jan 11, 2019
VS Code Configuration
View Extensions
.Net Core Tools
Add jsdoc comments
ASP.Net Core Snippets
ASP.Net core VS Code Extension Pack
ASP.Net Helper
AutoHotkey
Beautify
Better Comments
C#
C# Extensions
You can’t perform that action at this time.