Skip to content

Instantly share code, notes, and snippets.

View rasoulian's full-sized avatar
😎
Focusing

Ali Rasoulian rasoulian

😎
Focusing
View GitHub Profile
p = np.linspace(10, 16) # price range
d_means = np.exp(s.log_b + s.a * np.log(p).reshape(-1, 1))
plt.plot(p, d_means, c = 'k', alpha = 0.01)
plt.plot(p0, d0, 'o', c = 'r')
plt.show()
@alirezanet
alirezanet / Iran96-97.json
Last active March 17, 2024 14:41
List of provinces, states and cities of Iran with geographical coordinates (96-97 update)
[
{
"latitude": "34° 31' 24.924",
"longitude": "50° 0' 20.866",
"province": "مرکزی",
"state": "آشتیان",
"city": "آشتیان"
},
{
"latitude": "33° 40' 29.197",
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@marisks
marisks / CreatedAndModifiedDateInterceptor.cs
Created February 27, 2016 06:46
Entity Framework soft delete, modiefied and created date interceptors
using System;
using System.Data.Entity.Core.Common.CommandTrees;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Infrastructure.Interception;
using System.Linq;
public class CreatedAndModifiedDateInterceptor : IDbCommandTreeInterceptor
{
public const string CreatedColumnName = "Created";
public const string ModifiedColumnName = "Modified";
@karbyninc
karbyninc / StrategyPattern.cs
Last active July 4, 2018 10:34
The Strategy Pattern
namespace StrategyPattern.Contracts
{
public interface IDiscountStrategy
{
decimal ApplyDiscount(decimal price);
}
}
@karbyninc
karbyninc / ExceptionHandlers.cs
Last active July 4, 2018 10:38
Handling Errors in Web API Using Exception Filters and Exception Handlers
public override void OnException(HttpActionExecutedContext actionExecutedContext)
Tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure && make
@kiichi
kiichi / ImageResizeTest.cs
Last active July 1, 2023 07:56
Image Resize Example in C#
// Add System.Drawing as a reference.
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace ImageResizeTest {
class Program {
static void Main(string[] args) {
string path = @"C:\\Users\kiichi\work\ImageResizeTest\geo-elevation.png";
Resize(path, 600, 600);
@maartenba
maartenba / DomainTemplateRoute - GetVirtualPath
Last active May 15, 2023 07:30
ASP.NET MVC 6 / ASP.NET 5 Domain Routing + Tenant Middleware
public string GetVirtualPath(VirtualPathContext context)
{
foreach (var matcherParameter in _matcher.Template.Parameters)
{
context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters
}
return _innerRoute.GetVirtualPath(context);
}