Skip to content

Instantly share code, notes, and snippets.

View mrtank's full-sized avatar

Márton Garai mrtank

  • Budapest, Hungary
View GitHub Profile
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
/^[A-J]/ : search for lines beginning with one or more A-J
@mrtank
mrtank / Hangman.cs
Last active February 14, 2023 12:28
HangmanTests.cs
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Reactive;
using System.Reactive.Subjects;
public class HangmanState
{
public string MaskedWord { get; }
@mrtank
mrtank / ReadStringBytes.cs
Created March 17, 2021 23:10
Splitting into byte[]
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
namespace Stuff
{
class Program
class BindableBase {}
class ValidationRule<T>// where T : BindableBase
{}
class RuleCollection<VM> where VM : BindableBase
{
public RuleCollection<VM> AddRule<T>(VM _, Expression<Func<VM, object>> expression, params ValidationRule<T>[] rules)
{ return this; }
}
@mrtank
mrtank / 2020-04-29.log
Created April 29, 2020 09:27
Using Identity Server 3 for Caching external authentication InMemory
2020-04-29 11:14:18.8172 WARN AuthorizationCodeStore not configured - falling back to InMemory
2020-04-29 11:14:18.8662 WARN TokenHandleStore not configured - falling back to InMemory
2020-04-29 11:14:18.8702 WARN ConsentStore not configured - falling back to InMemory
2020-04-29 11:14:18.8702 WARN RefreshTokenStore not configured - falling back to InMemory
2020-04-29 11:14:19.3462 WARN No signing certificate configured.
...
2020-04-29 11:18:15.7850 DEBUG HTTP Request
{
"Method": "GET",
"Url": "http://localhost:20000/identity/connect/authorize?client_id=aa&redirect_uri=http%3a%2f%2flocalhost%3a20000%2f&response_mode=form_post&response_type=id_token+token&scope=openid+profile+roles+sampleApi&state=OpenIdConnect.AuthenticationProperties%3d1igJGbZToR2vhXo3m3mK2CV5h6ZaUFcYAZ38LTL-VGd3KUmbTThmu0cW3Y5EwSSyFp24fE34uoMxYzgc2myETjpGuwglidKYGpSrLRR36YyuiwFo0eh4q8SR8rTGz2zUq2we1P7QgPRY5yoWi_OwSHOoLQ2atrYh2wTuLhcarBKN-8zWIg-FdkXyOViMfFMW87j9Ba4-A0-yLlviaAqCXQ&nonce=637237486957770487.ZTIwMDc4YjUtYmJiZC00OThiLTg0YmMtY2
static void Main(string[] args)
{
UdpClient udpClient = new UdpClient();
udpClient.Connect(new IPEndPoint(IPAddress.Broadcast, 11000));
Byte[] sendBytes = Encoding.ASCII.GetBytes("Is anybody there?");
udpClient.Send(sendBytes, sendBytes.Length);
}
public int counter { get; set; }
public async void test()
{
var uiThreadScheduler = TaskScheduler.FromCurrentSynchronizationContext();
while(true)
{
Task backgroundTask = Task.Run (async () => {
await Task.Delay(300);
Interlocked.Increment(ref this.counter);
while (!quit)
{
var uiThreadScheduler = TaskScheduler.FromCurrentSynchronizationContext();
Task<decimal> backgroundTask = Task.Run (() => {
var lastPrice = (decimal)NTClient.MarketData(inst, 0);
Interlocked.Increment(ref this.theCounter);
return lastPrice;
};
backgroundTask.ContinueWith((t) => {
<handle t.IsFaulter>
@mrtank
mrtank / _vimrc.vim
Created April 3, 2020 10:12
my vimrc
set encoding=utf-8
scriptencoding utf-8
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
#######
LanguageClient 0.1.155
#######
11:59:49 WARN unnamed src/language_server_protocol.rs:2284 Failed to start language server automatically. No language server commands found for filetype: conf
11:59:49 ERROR unnamed src/rpchandler.rs:30 Error handling message: Error: Failure { jsonrpc: Some(V2), error: Error { code: InternalError, message: "\'Vim(let):E28: No such highlight group name: ALEInfo\'", data: None }, id: Num(31) }
Message: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"This value is unused","range":{"end":{"character":13,"line":3},"start":{"character":9,"line":3}},"relatedInformation":[],"severity":4,"source":"FSAC","tags":[1]}],"uri":"file:///E%3A/codejam/GoogleCodeJam20201/Solution.fs"}}
Error: ErrorMessage { msg: "Error: Failure { jsonrpc: Some(V2), error: Error { code: InternalError, message: \"\\\'Vim(let):E28: No such highlight group name: ALEInfo\\\'\", data: None }, id: Num(31) }" }
11:59:52 ERROR unnamed src/rpchandler.rs:14 Error h