Skip to content

Instantly share code, notes, and snippets.

View stephensmitchell's full-sized avatar
💭
NNODESS

Stephen S. Mitchell stephensmitchell

💭
NNODESS
  • NNODESS
  • Earth
View GitHub Profile
@stephensmitchell
stephensmitchell / JuliaOctaveNumpy.md
Created September 15, 2020 08:10 — forked from AlexanderFabisch/JuliaOctaveNumpy.md
Comparison of Julia, NumPy and Octave

Comparison of Julia, Python and Octave

Overview

Julia is a new languange for technical computing. It is a mix of R, Matlab, Python and other similar languages. Its main advantage is its speed: it is just in time (JIT) compiled and almost as fast as C. Another advantage is its type inference, i.e. you do not have to specify types (although you can), but all variables are statically typed. It is a high level language that is fast as well. Here I compare the behavior to similar

@stephensmitchell
stephensmitchell / Articles.svelte
Created September 12, 2020 11:29 — forked from praveenweb/Articles.svelte
Fetch Articles using GraphQL in Svelte
<script context="module">
import gql from 'graphql-tag';
import { client } from './apollo';
const ARTICLES = gql`
{
article {
id
title
author {
@stephensmitchell
stephensmitchell / ColorConsole.cs
Created August 19, 2020 13:38 — forked from RickStrahl/ColorConsole.cs
Color Console - a simple class to add color to .NET Console commands more easily.
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace MainColorConsole
{
class Program
{
static void Main(string[] args)
{
@stephensmitchell
stephensmitchell / ProjectSymbol.cs
Created August 17, 2020 13:03 — forked from KlausLoeffelmann/ProjectSymbol.cs
Demo for SkiaSharp based Custom Control in Xamarin.Forms
using SkiaSharp;
using SkiaSharp.Views.Forms;
using System;
using System.Runtime.CompilerServices;
using Xamarin.Forms;
namespace Legatro.Cross.Controls
{
class ProjectSymbol : SKCanvasView
{
@stephensmitchell
stephensmitchell / check_github_repo_size
Created August 14, 2020 07:14 — forked from dingzeyuli/check_github_repo_size
Check the size of a github repo before downloading
# http://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning
# tested on macOS
echo https://github.com/torvalds/linux.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -I{} curl -s -k https://api.github.com/repos/'{}' | grep size
# output:
# "size": 1746294,
@stephensmitchell
stephensmitchell / blazor-state-user-docs.md
Created August 13, 2020 11:23 — forked from SteveSandersonMS/blazor-state-user-docs.md
Preserving State in Server-Side Blazor applications

Preserving State in Server-Side Blazor applications

Server-side Blazor is a stateful application framework. Most of the time, your users will maintain an ongoing connection to the server, and their state will be held in the server's memory in what's known as a "circuit". Examples of state held for a user's circuit include:

  • The UI being rendered (i.e., the hierarchy of component instances and their most recent render output)
  • The values of any fields and properties in component instances
  • Data held in DI service instances that are scoped to the circuit

Occasionally, users may experience a temporary network connection loss, after which Blazor will attempt to reconnect them to their original circuit so they can continue.

@stephensmitchell
stephensmitchell / github.css
Created August 8, 2020 01:37 — forked from theconektd/github.css
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@stephensmitchell
stephensmitchell / blazor-auth.md
Created August 2, 2020 08:47 — forked from SteveSandersonMS/blazor-auth.md
Blazor authentication and authorization

Authentication and Authorization

Authentication means determining who a particular user is. Authorization means applying rules about what they can do. Blazor contains features for handling both aspects of this.

It worth remembering how the overall goals differ between server-side Blazor and client-side Blazor:

  • Server-side Blazor applications run on the server. As such, correctly-implemented authorization checks are both how you determine which UI options to show (e.g., which menu entries are available to a certain user) and where you actually enforce access rules.
  • Client-side Blazor applications run on the client. As such, authorization is only used as a way of determining what UI options to show (e.g., which menu entries). The actual enforcement of authorization rules must be implemented on whatever backend server your application operates on, since any client-side checks can be modified or bypassed.

Authentication-enabled templates for Server-Side Blazor

@stephensmitchell
stephensmitchell / Test-DNSName.ps1
Created July 18, 2020 13:59 — forked from JustinGrote/Test-DNSName.ps1
High Performance DNS Resolver in Powershell
using namespace System.Net
using namespace System.Threading.Tasks
using namespace System.Management.Automation
using namespace System.Collections.Generic
function Test-DNSName ([String[]]$hostnames, [int]$Timeout = 3000) {
<#
.SYNOPSIS
Given a list of DNS names, returns the ones that actually resolve to an actual name
#>
@stephensmitchell
stephensmitchell / newproject
Created July 18, 2020 11:40 — forked from drdrang/newproject
Script to create database entries, folders in iCloud, a folder in Mail, and a set of labels for a new project.
#!/usr/bin/python
import sqlite3
import os
import sys
from applescript import asrun
from subprocess import Popen, PIPE
import shutil
import requests
import json