Skip to content

Instantly share code, notes, and snippets.

View bezzad's full-sized avatar
:octocat:
Hi

Behzad Khosravifar bezzad

:octocat:
Hi
View GitHub Profile
@bezzad
bezzad / VSSolutionInspection.tt
Created January 9, 2017 12:30 — forked from cairey/VSSolutionInspection.tt
Inspect the Visual Studio solution and project settings using T4 template code gen.
<#@ template language="C#" debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ assembly name="EnvDTE" #>
<#@ Assembly Name="System.Windows.Forms.dll" #>
<#@ Assembly name="System.Configuration"#>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
@bezzad
bezzad / DataTableExtensions.cs
Last active April 23, 2017 12:56
Extension methods for convert `DataTable` to any other types like: Generic Type `T` , dynamic object
public static class Extension
{
public static IList<T> ToList<T>(this DataTable dt, bool isFirstRowColumnsHeader = false) where T : new()
{
var results = new List<T>();
if (dt != null && dt.Rows.Count > 0)
{
var columns = dt.Columns.Cast<DataColumn>().ToList();
var rows = dt.Rows.Cast<DataRow>().ToList();
@abouzarnouri
abouzarnouri / RateLimiter.cs
Last active April 30, 2018 09:45
Simple invocation rate checker
using System;
using System.Runtime.Caching;
namespace Hasin.Taaghche.Utilities
{
// Use this class to put restriction on the number of invocations of an endpoint in your system by a given input.
// E.g., when a user wants to login with "[email protected]", call CanProceed("[email protected]") to check if she can do that.
public class RateLimiter
{
private readonly MemoryCache _cache;
@hadisfr
hadisfr / outline-server-setup.md
Last active December 21, 2025 20:37 — forked from okeehou/outline-server-setup.md
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server and use Outline Manager.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows

@bezzad
bezzad / ObservableConcurrentDictionary.cs
Last active July 22, 2018 10:30
Provides a thread-safe dictionary for use with data binding.
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Threading;
namespace System.Collections.Generic
{
/// <summary>
@bezzad
bezzad / StartIIS.cs
Created July 22, 2018 10:32
Programmatically start IIS Express from code.
public static class IISExpress
{
private static readonly List<string> sites = new List<string>();
private static readonly List<string> paths = new List<string>();
public static void StartIISExpress(string site, int port = 7329)
{
if(!sites.Contains(site.ToLower()))
sites.Add(site.ToLower());
else return;
@bezzad
bezzad / animation-using-angularjs-ui-router-and-nganimate.markdown
Last active November 10, 2018 08:16
Animation using AngularJS ui-router and ngAnimate

Animation using AngularJS ui-router and ngAnimate

Feel free to use this code if you are using AngularJS Framework in your application. This will help you easily create beautiful animated wizards or cover other UI scenarios that require a step-by-step interactions. Better used for single-page apps.

A Pen by Behzad Khosravifar on CodePen.

License.

import requests
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
query = 'http://members.tsetmc.com/tsev2/chart/data/Financial.aspx'
params = {
'i': '18027801615184692',
't': 'ph',
@selcukusta
selcukusta / Dockerfile
Last active June 11, 2023 08:01
Using MS font family in Debian 9 based ASP.NET Core Docker images
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim as runtime
RUN apt-get update && \
apt-get install -y wget \
fontconfig && \
wget http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb && \
apt --fix-broken install -y ./ttf-mscorefonts-installer_3.6_all.deb && \
rm ttf-mscorefonts-installer_3.6_all.deb && \
fc-cache -f -v
@bezzad
bezzad / BinarySearch
Last active October 22, 2019 07:07
Binary search implementation to search a value of type T1 within a list of T2 type which comparable by value argument.
using System;
using System.Collections.Generic;
public static class Helper
{
/// <summary>
/// Searches a section of the list for a given element using a binary search
/// algorithm.
/// </summary>
/// <param name="items">list of <see cref="TItems"/>, which must be searched within</param>