Skip to content

Instantly share code, notes, and snippets.

View yvanin's full-sized avatar

Yuri Vanin yvanin

  • San Francisco Bay Area
View GitHub Profile
@yvanin
yvanin / .theanorc.txt
Last active April 11, 2017 08:23
Theano config which works on Win8.1 x64 with GPU
[global]
floatX = float32
# pycuda didn't work so using "new backend"
# pygpu+libgpuarray installed via conda ("conda install pygpu")
device = cuda
[nvcc]
# CUDA v8.0 installed over VS 2012
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe
@yvanin
yvanin / azure.ps1
Last active October 20, 2016 13:16
Connecting to the Azure subscription from Azure Powershell
# Connect your account, you will be prompted to enter your credentials in the popup
Add-AzureAccount
# Check that your subscription has been loaded
Get-AzureSubscription
# Select a subscription as default if needed
Select-AzureSubscription -Default <SubscriptionName>
@yvanin
yvanin / Quick HTTP proxy on Windows.md
Last active December 16, 2022 10:27
HTTP proxy with basic authentication using Squid
@yvanin
yvanin / HtmlHelperExtensions.cs
Last active August 29, 2015 14:24
ASP.NET MVC Html helper for showing a UTC date from a server in the timezone of a browser
public static MvcHtmlString LocalDateTime(this HtmlHelper helper, DateTime utcDateTime)
{
return new MvcHtmlString(
String.Format(
"<script>var d=new Date('{0}');document.write(new Date(d.getTime()-d.getTimezoneOffset()*60000))</script>",
utcDateTime.ToString("g")));
}
@yvanin
yvanin / gist:ab40548fc6bf7a1d8a68
Last active November 8, 2019 06:19
Test SQL connection in Wix

Custom action (in C# dll):

[CustomAction]
public static ActionResult TestDbConnection(Session session)
{
    using (var connection = new SqlConnection(session["CONNECTION_STRING"]))
    {
        try
        {
@yvanin
yvanin / AwsV4SignatureCalculator.cs
Last active March 5, 2024 20:37
This C# code calculates a request signature using Version 4 signing process. It was developed for and tested on Amazon SQS requests, so it does not cover every scenario for the other services, e.g. multipart uploads are not supported. Nevertheless, it's simple and independent single class that can be easily embedded into other projects. .NET Fra…
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
namespace AwsV4SignatureCalculator
@yvanin
yvanin / kCombinations.fsx
Created January 1, 2015 21:19
Producing k-combinations of a set of elements in F#
// assuming elements in a set do not repeat
let rec kCombinations k (set: 'a list) =
match k with
| 1 -> set |> List.map (fun x -> [x])
| _ ->
match set with
| [] -> []
| head::tail ->
(tail |> kCombinations (k - 1) |> List.map (fun x -> head::x))
@ (tail |> kCombinations k)