This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BloomFilter | |
{ | |
using System; | |
using System.Collections; | |
/// <summary> | |
/// Bloom filter. | |
/// </summary> | |
/// <typeparam name="T">Item type </typeparam> | |
public class Filter<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual void Defrag() | |
{ | |
// nothing to do | |
if (Header.UnalignedFreeBytes == 0) | |
return; | |
var regions = GetFreeRegions(); | |
var freeRegions = regions.Count; | |
// maximum number of loops to is the initial number of regions with free space | |
int maxLoops = regions.Count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Linq; | |
using System.Numerics; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Intrinsics; | |
using System.Text; | |
using System.Threading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveFile(content) { | |
if(!content) { | |
console.error('Console.save: No data'); | |
return; | |
} | |
let filename = 'console.json'; | |
if(typeof data === "object"){ | |
data = JSON.stringify(data, undefined, 4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, | |
following problem I can create a token but when I use it the authentication failed, I try to copy from an example but I had problems because | |
some methods are not "there". (like principal.SetScopes) | |
Here the method for creating the token | |
[HttpPost("~/connect/token"), Produces("application/json")] | |
public async Task<IActionResult> Exchange(OpenIdConnectRequest connectRequest) | |
{ | |
if (connectRequest.IsPasswordGrantType()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjust the following variables as necessary | |
REMOTE=origin | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
BATCH_SIZE=500 | |
# check if the branch exists on the remote | |
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then | |
# if so, only push the commits that are not on the remote already | |
range=$REMOTE/$BRANCH..HEAD | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse, HttpHeaders } | |
from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/do'; | |
declare var MiniProfiler: any; | |
@Injectable() | |
export class MiniProfilerInterceptor implements HttpInterceptor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YourNamespace | |
{ | |
/// <summary> | |
/// Uses the Name value of the ColumnAttribute specified, otherwise maps as usual. | |
/// </summary> | |
/// <typeparam name="T">The type of the object that this mapper applies to.</typeparam> | |
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper | |
{ | |
public static readonly string ColumnAttributeName = "ColumnAttribute"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#REQUIRES -Version 3.0 | |
# This is a simple sample for access the MS UIAutomation in PowerShell. | |
# In this sample: | |
# 1. Load the MS UIA via System.Reflection.Assembly | |
# 2. Launch the AUT ( calc.exe ) | |
# 3. Find the AutomationElement via the AUT Process Id | |
# 4. Find buttons via 'ClassName' and 'Name' property | |
# 5. Click the '1', '+', '1', '=' buttons. | |
# At last, we will get '2' in the result of calc App. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string collatz(string input) | |
{ | |
int current = 0; | |
if (string.IsNullOrEmpty(input) || !int.TryParse(input, out current) || current < 1) { | |
return "Empty, not a number or less then 1"; | |
} | |
int max = current; | |
while (current > 1) { | |
if (current % 2 == 0) { | |
current = current / 2; // current reassigned |