Skip to content

Instantly share code, notes, and snippets.

View romeshniriella's full-sized avatar
🎯
Building blockchain infrastructure

Romesh Niriella romeshniriella

🎯
Building blockchain infrastructure
  • Melbourne, VIC, AU
View GitHub Profile
@kameko
kameko / ExceptionListener.cs
Created April 30, 2021 23:11
ExceptionListener
namespace Your.Namespace.Here
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
public static class ExceptionListenerExtensions
@page "/tsp"
@inject IJSRuntime _js
<div class="container">
<div class="row">
<div>
Cities: <input type="text" @bind=@_numberOfCities onblur=@ResetGA disabled=@_tspGA.IsRunning />
</div>
<div>
<button onclick=@ResetGA disabled=@_tspGA.IsRunning >Reset</button>
@richlander
richlander / mcr-registry-tag-inspection.md
Last active March 17, 2023 18:46
Inspect MCR Registry Tags for .NET Core

Inspect MCR Registry Tags for .NET Core

This workflow explores the 3.0 manifest-based tag in the mcr.microsoft.com/v2/dotnet/core/runtime repo on MCR as an example. It uses curl to call a set of container registry APIs to find image digests, layer digests, and layer location. This example is intended to show the separation between MCR as a image manifest service and Azure CDN as an image layer service.

This pattern can be used on any operating system, but the specific commands are OS-specific. curl is included in the latest versions of Windows and is also in most Linux and macOS distributions. findstr is part of Windows, however, grep can be used on Linux or macOS instead.

Inspect Manifest tag

The 3.0 tag is a manifest tag. It represents a set of potential candidate images, for various operating systems and operating systems versions. When a manifest tag is pulled by a docker client, the client picks the best image for the host op

@ekepes
ekepes / ConsoleApplication2.cs
Last active January 8, 2022 05:00
C# implementation of a Linear Congruential Generator (LCG) for psuedorandom number generation
using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
var freq = new int[20];
var rng = new RandomNumberGenerator();
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active May 29, 2024 05:17
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
This file has been truncated, but you can view the full file.
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
{
@alindgren
alindgren / MultilingualContentFinder.cs
Last active August 13, 2018 15:24
ContentFinder for multilingual sites in Umbraco
using System;
using System.Globalization;
using System.Web;
using Umbraco.Web.Routing;
using Umbraco.Core;
public class MultilingualContentFinder : IContentFinder
{
public bool TryFindContent(PublishedContentRequest contentRequest)
{
package com.esoftdive.core.smpp.internal;
import java.util.Random;
import com.cloudhopper.commons.charset.CharsetUtil;
import com.cloudhopper.smpp.SmppConstants;
import com.cloudhopper.smpp.SmppSession;
import com.cloudhopper.smpp.pdu.SubmitSm;
import com.cloudhopper.smpp.type.Address;
<?php
/**
* FuzzyDateParser is meerly a "convinience" wrapper around date_parse
* functionality from ext/date/lib/timelib code (which does all the
* scanning and other "fuzzy" guessing work).
*
* @see http://www.php.net/manual/en/function.date-parse.php
* @see http://stackoverflow.com/questions/15350309/heuristic-fuzzy-date-extraction-from-the-string
*
* by Yauhen Yakimovich, 2013
@techniq
techniq / select2_ajax.js
Created January 23, 2013 16:24
Select2 ajax example with custom query call to append data to the request. Note: Providing ajax settings is not needed (and not used) when query is provided. Left here as a full example.
$("[data-provide='select2']").each(function () {
var $element = $(this);
$element.select2({
placeholder: $element.data("placeholder"),
minimumInputLength: 0,
allowClear: true,
initSelection: function (element, callback) {
callback({
id: $(element).val(),
@haf
haf / Downloading the sample
Created June 26, 2012 21:57
Semantic Logging
git clone git://github.com/haf/semantic-logging.git
cd semantic-logging
git submodule update --init
./download.sh
vagrant up