Skip to content

Instantly share code, notes, and snippets.

@tupunco
tupunco / ConcurrentConsumerQueue.cs
Last active August 29, 2015 13:59
ConcurrentConsumerQueue 并行消费者队列
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Tup.Utilities
{
/// <summary>
/// 并行消费者队列
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{
public class Tree
{
/// <summary>
/// store the tree's root
/// </summary>
private Node _root;
/// <summary>
/// construct a new tree with it's root
/// </summary>
@tupunco
tupunco / Netflix.js
Created January 5, 2012 09:19 — forked from rbartholomew/Netflix.js
Netflix Windows 8
(function () {
'use strict';
var clientKey = "XXXXXXXXXXXXXX";
var clientSecret = "XXXXXXXXXXXX";
var oauthToken;
var oauthSecret;
var userId;
var loginUrl;
var applicationName;
@tupunco
tupunco / SerializableDictionary.cs
Created December 14, 2015 07:38
XML Serializable Collections, 可 XML 序列化的 字典/HashSet 类型
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace Tup.Utilities
{
/// <summary>
/// 支持XML序列化的泛型Dictionary类
@tupunco
tupunco / ExecuteAction.cs
Last active December 14, 2015 07:39
C# 同步/异步执行 控制台 命令
/// <summary>
/// Async Execute Command Action
/// </summary>
/// <param name="startFileName"></param>
/// <param name="startFileArg"></param>
/// <param name="msgAction"></param>
/// <returns></returns>
public static Task<bool> ExecuteActionAsync(string startFileName, string startFileArg, Action<string> msgAction)
{
ThrowHelper.ThrowIfNull(msgAction, "msgAction");
@tupunco
tupunco / BizResult.cs
Created December 18, 2015 01:05
业务逻辑 返回结果
/// <summary>
/// 业务逻辑 返回结果
/// </summary>
/// <remarks>
/// 建议以本类型为返回对象的方法, 不要返回 null 对象.
///
/// 提供三种方法创建本实例:
/// 直接实例:
/// new BizResult<Dish>(...);
///
@tupunco
tupunco / IRng.cs
Created April 25, 2016 14:00
Weight Rand Helper
public interface IRng
{
int Next(int maxValue);
int Next(int minValue, int maxValue);
int Next();
void NextBytes(byte[] buffer);
double NextDouble();
}
@tupunco
tupunco / issues_505.md
Last active April 30, 2016 14:42
derekparker_delve bug issues_505

windows 'dlv debug' include 'exec.LookPath(os.Args[0])' error #505

issues#505

  1. What version of Delve are you using (dlv version)?

master

  1. What version of Go are you using? (go version)?
@tupunco
tupunco / ubuntu-note.md
Last active May 10, 2016 08:34
ubuntu 16.04 setup
  1. windows grub
  • update-grub2
  • sudo gedit /etc/default/grub
  1. setup ubuntu-mate
  • ubuntu-mate-core >* ubuntu-mate-desktop