Skip to content

Instantly share code, notes, and snippets.

View JerryBian's full-sized avatar
🀄
Focusing

Jerry Bian JerryBian

🀄
Focusing
  • HangZhou, China
  • 17:43 (UTC +08:00)
  • X @cnbian
View GitHub Profile
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace WpfApplication1.ViewModel
{
public class MainWindowViewModel : INotifyPropertyChanged
{
public MainWindowViewModel()
{
InitSourceCollection();
class Program
{
static void Main(string[] args)
{
var context = new TestContext();
context.Parents.Add(new Parent
{
Name = "Parent",
using System;
using System.Text;
namespace ConsoleApplication1
{
using System.Globalization;
using System.Net.Http;
using System.Security.Cryptography;
class Program
static void SetServiceProperties()
{
var requestMethod = "PUT";
var requestBody = string.Format("<StorageServiceProperties><Cors><CorsRule><AllowedOrigins>{0}</AllowedOrigins><AllowedMethods>{1}</AllowedMethods><MaxAgeInSeconds>{2}</MaxAgeInSeconds><ExposedHeaders>{3}</ExposedHeaders><AllowedHeaders>{4}</AllowedHeaders></CorsRule></Cors></StorageServiceProperties>", "http://www.baidu.com", "GET,PUT", 200, "x-ms-meta-*", "x-ms-meta-data*,x-ms-meta-target,x-ms-meta-source");
var storageServiceVersion = "2014-02-14";
var date = DateTime.UtcNow.ToString("R");
var canonicalizedHeaders = string.Format("x-ms-date:{0}\nx-ms-version:{1}", date, storageServiceVersion);
var canonicalizedResource = string.Format("/{0}\ncomp:properties\nrestype:service", StorageAccount);
var stringToSign = string.Format("{0}\n\n\n{1}\n\ntext/plain; charset=utf-8\n\n\n\n\n\n\n{2}\n{3}", requestMethod, requestBody.Length, canonicalizedHeaders, canonicalizedResource);
var authorizationHeader = GetAuthorization
@JerryBian
JerryBian / Fisher-Yates-C#.cs
Last active April 13, 2020 13:16
Fisher-Yates-C#
public static class Program
{
private static readonly string[] Arrays = new[]
{
"jerry",
"Kate",
"Steve",
"Mark",
"Joe"
};
workflow Auto-RestartVM
{
Param
(
[Parameter(Mandatory = $true)]
[String]
$AzureConnectionName,
[Parameter(Mandatory = $true)]
[String]
@JerryBian
JerryBian / TweetHttpClient.cs
Created October 22, 2015 03:47
Get Twitter Home Timeline via C#
public class TweetHttpClient : ITwitterHttpClient
{
public TweetHttpClient()
{
_httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.twitter.com/")
};
}
@JerryBian
JerryBian / useful-script.sh
Last active June 5, 2020 14:08
Handy useful shell scripts
# setup NPM behinds a HTTP proxy
npm config set proxy http://127.0.0.1:1098
npm config set https-proxy http://127.0.0.1:1098
# unset NPM proxy
npm config rm proxy
npm config rm https-proxy
# set NPM to mirror registry
npm config set registry https://registry.npm.taobao.org