Skip to content

Instantly share code, notes, and snippets.

View ibrahimatay's full-sized avatar

İbrahim ATAY ibrahimatay

View GitHub Profile
@ibrahimatay
ibrahimatay / BloomFilter.cs
Created May 17, 2021 12:20 — forked from haneytron/BloomFilter.cs
A simple Bloom Filter implementation in C#
using System;
namespace BloomFilter
{
class Program
{
static void Main(string[] args)
{
AddItem("test");
AddItem("test2");
@ibrahimatay
ibrahimatay / MarsRovers.cs
Created May 17, 2021 12:20 — forked from haneytron/MarsRovers.cs
A compact C# solution to the Mars Rovers ThoughtWorks problem described in my repo: https://github.com/ironyx/marsrovers
static void Main(string[] args)
{
var input = @"5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM".Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
var bounds = input[0].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(i => int.Parse(i)).ToArray();
var dirs = "NESW"; var magnitudes = new[] { Tuple.Create(0, 1), Tuple.Create(1, 0), Tuple.Create(0, -1), Tuple.Create(-1, 0) };
for (int i = 1; i < input.Length; i += 2) {
@ibrahimatay
ibrahimatay / README.md
Created May 10, 2021 15:25 — forked from dims/README.md
Kubernetes Resources
public static class RandomGenerator
{
private static readonly RandomNumberGenerator generator = RandomNumberGenerator.Create();
public static int GetNext()
{
byte[] rndArray = new byte[4];
generator.GetBytes(rndArray);
return BitConverter.ToInt32(rndArray, 0);
public static string RandomString(int length)
{
char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
byte[] data = new byte[length];
using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
{
crypto.GetBytes(data);
}
StringBuilder result = new StringBuilder(length);
private static string TurkishCitizenshipNumberGenerator()
{
Random random = new Random();
int x = random.Next(100_000_000, 1_000_000_000);
int d1 = x / 100_000_000;
int d2 = (x / 10_000_000) % 10;
int d3 = (x / 1_000_000) % 10;
int d4 = (x / 100_000) % 10;
int d5 = (x / 10_000) % 10;
int d6 = (x / 1000) % 10;
@ibrahimatay
ibrahimatay / SSEinstructionsSolution.py
Created July 9, 2017 10:58
"The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations" in "Hello, TensorFlow!" program
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
hello = tf.constant("Hello, Tensorflow on Windows!")
sess = tf.Session()
print(sess.run(hello))
namespace MvcExtonsionMethod.Csharp.Extensions
{
using System.Web;
using System.Web.Mvc;
public static class ImageExtension
{
public static IHtmlString Image(this HtmlHelper h, string src,
int width,
int height,
private static List<string> GetDomainUser()
{
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, "");
///LDAP://OU=Domain,DC=YourDomain,DC=com
UserPrincipal insUserPrincipal = new UserPrincipal(principalContext);
insUserPrincipal.Name = "*";
insUserPrincipal.Enabled = true;
PrincipalSearcher insPrincipalSearcher = new PrincipalSearcher(insUserPrincipal);