Skip to content

Instantly share code, notes, and snippets.

View shoter's full-sized avatar
🙃

Damian shoter

🙃
View GitHub Profile
using System;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
var summary = BenchmarkRunner.Run<StringBenchmark>();
[MemoryDiagnoser]
public class StringBenchmark
{
@shoter
shoter / benchmark2.cs
Created May 24, 2023 11:47
string interp vs building higher nesting
using System;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
var summary = BenchmarkRunner.Run<StringBenchmark>();
[MemoryDiagnoser]
public class StringBenchmark
{
@shoter
shoter / benchmark.cs
Created May 24, 2023 11:39
String Interpolation vs String Builder exception throwing benchmark
using System;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
var summary = BenchmarkRunner.Run<StringBenchmark>();
public class StringBenchmark
{
private const string testVariable = "test";
@shoter
shoter / gist:aed0d7a1e4fae6e9c7d418b33bd86148
Created December 15, 2020 08:25
How fast ServiceCollection is being created
public class HowFastItIsToExecuteServiceProvider
{
const int N = 100;
Type[] types = new Type[N];
IServiceCollection serviceCollection = new ServiceCollection();
public HowFastItIsToExecuteServiceProvider()
{
var tb = GetTypeBuilder();
for (int i = 0; i < N; ++i)
@shoter
shoter / benchmark.cs
Created December 14, 2020 21:26
is WithContinue faster?
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace _13
{
public class AggregateExceptions
{
Dim objResult
Set objShell = WScript.CreateObject("Wscript.Shell")
do While True
objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
Wscript.Sleep(150000)
Loop
@shoter
shoter / Deleter.py
Created September 17, 2018 10:39
Simple File deleter for windows 10
import os, time, sys
from win10toast import ToastNotifier
toast = ToastNotifier()
def str_join(*args):
return ''.join(map(str, args))
def warnAboutOldFiles(path, days):
path = "C:\\Users\\damian_laczak\\Downloads"
@shoter
shoter / .cs
Created March 30, 2018 08:26
NinjectableJob
public abstract class NinjectableJob : IJob
{
protected IKernel kernel;
public void Execute()
{
using(kernel = new StandardKernel())
{
NinjectSingletonCommon.RegisterTypes(kernel);
execute();
#include <iostream>
#include <conio.h>
const int PRZELOT_COUNT = 4;
#define LINE_BREAK std::cout << "---------------------------------------------------" << std::endl;
//napisz progrma w ktorej zadeklarujesz tablice struktua, struktura o nazwie przelot zawiera
// nastepujace elementy : trasa(dokad),
//cena
//dlugosc trasy
//czas- w godzinach
//linia
@shoter
shoter / loadFile( std::string filename )
Created September 11, 2013 08:55
Loading file content into buffer.
std::vector<std::string>* loadFile( std::string filename )
{
std::ifstream fileStream;
fileStream.open( filename.c_str() );
std::vector<std::string> *strings = new std::vector<std::string>();
int i = 0;
while(!fileStream.eof())
{
strings->push_back(std::string());
fileStream >> (*strings)[i++];