Skip to content

Instantly share code, notes, and snippets.

:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

:shipit:
💥 shakalaka
Block or report user

Report or block tugberkugurlu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tugberkugurlu
tugberkugurlu / FizzBuzz.cs
Last active May 29, 2019
FizzBuzz problem solution with C#.
View FizzBuzz.cs
// reference: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
static class Program {
static void Main(string[] args) {
for (int i = 1; i <= 100; i++) {
bool canBeMultipliedByFive = i.CanBeMultipliedBy(5);
bool canBeMultipliedByThree = i.CanBeMultipliedBy(3);
View 0001-cache-invalidation-imperatively.patch
From f629b295fc8f9bbd44904284cb0ec832d51185be Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 30 Apr 2019 09:55:44 +0100
Subject: [PATCH] cache invalidation, imperatively
---
postsharp/0-caching/1-sample-web/Startup.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/postsharp/0-caching/1-sample-web/Startup.cs b/postsharp/0-caching/1-sample-web/Startup.cs
View 0001-cache-invalidation-declarative.patch
From f0889e68e55298e43360e01dd3b0e8b1cf6468e3 Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 30 Apr 2019 09:40:21 +0100
Subject: [PATCH] cache invalidation, declarative
---
postsharp/0-caching/1-sample-web/Startup.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/postsharp/0-caching/1-sample-web/Startup.cs b/postsharp/0-caching/1-sample-web/Startup.cs
View 0001-add-caching.patch
From a20fc8e95ffd9bf5d424467e0e1283ae5891454a Mon Sep 17 00:00:00 2001
From: Tugberk Ugurlu
Date: Tue, 9 Apr 2019 23:38:32 +0100
Subject: [PATCH] add caching
---
postsharp/0-caching/1-sample-web/1-sample-web.csproj | 1 +
postsharp/0-caching/1-sample-web/Program.cs | 3 +++
postsharp/0-caching/1-sample-web/Startup.cs | 4 +++-
3 files changed, 7 insertions(+), 1 deletion(-)
View Startup.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
View 0001-log.patch
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
+using PostSharp.Patterns.Diagnostics;
+using PostSharp.Patterns.Diagnostics.Backends.Console;
namespace _1_sample_web
{
+ [Log(AttributeExclude = true)]
public class Program
View GlobalAspects.cs
using PostSharp.Patterns.Diagnostics;
using PostSharp.Extensibility;
[assembly: Log(AttributePriority = 1, AttributeTargetMemberAttributes = MulticastAttributes.Protected | MulticastAttributes.Internal | MulticastAttributes.Public)]
[assembly: Log(AttributePriority = 2, AttributeExclude = true, AttributeTargetMembers = "get_*" )]
View bcdedit.ps1
##################################################
#resources
##################################################
#http://technet.microsoft.com/en-us/library/cc721886(v=ws.10).aspx
#http://technet.microsoft.com/en-us/library/cc709667(v=ws.10).aspx
##################################################
#resources
##################################################
####################################################################################
@tugberkugurlu
tugberkugurlu / Program.cs
Created Jan 14, 2019
Call private methods on implementation of the abstract class. This could be handy for the abstract Aggregate class which can get the event stream and populate the aggregate.
View Program.cs
using System;
using System.Linq;
using System.Reflection;
namespace abstract_impl_reflect
{
public class Foo : FooBase
{
public Foo() : base()
{
@tugberkugurlu
tugberkugurlu / enc_dec.ps1
Created Jul 7, 2012
ENCRYPTING A STRING USING CERTIFICATES AND POWERSHELL
View enc_dec.ps1
Function encrypt-envelope ($unprotectedcontent, $cert)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
$utf8content = [Text.Encoding]::UTF8.GetBytes($unprotectedcontent)
$content = New-Object Security.Cryptography.Pkcs.ContentInfo `
You can’t perform that action at this time.