As The last ship sailed towards the distant horizon I sat there watching on a rock My mind slowly drifting away Forming into my... Dreamtale
2019-03-10

Singleton from https://www.suntabu.com/page/?d=1512300646985



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityToolbag.Singleton;

public class ResourcesManager : Singleton<ResourcesManager>
{
    private ResourcesManager()
2019-03-10

ResourcesManager from https://www.suntabu.com/page.html?d=1552226655668


using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Assertions;

public class AudioManager : MonoBehaviour
{
    /// <summary>
    /// cached audiosource componets list. 
2019-02-28

From https://blog.cloudflare.com/introducing-the-workers-cache-api-giving-you-control-over-how-your-content-is-cached/

At Cloudflare, we aim to make the Internet faster and safer for everyone. One way we do this is through caching: we keep a copy of our customer content in our 165 data centers around the world. This brings content closer to users and reduces traffic back to origin servers.

Today (25 Jan 2019), we’re excited to announce a huge change in our how cache works. Cloudflare Workers now integrates the Cache API, giving you programmatic control over our caches around the world.

2019-02-28

From https://github.com/websperts/tinypng-cli


#!/usr/bin/env node

var fs = require('fs');
var request = require('request');
var minimatch = require('minimatch');
var glob = require('glob');
var uniq = require('array-uniq');
var chalk = require('chalk');
var pretty = require('prettysize');
2019-01-26

Client Codes

  • Core Codes

    public class UploadFile
    {
        public UploadFile()
        {
            ContentType = "application/octet-stream";
        }
    
        public string Name { get; set; }
2019-01-21

From https://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data

 public static void HttpUploadFile(string url, string file, string paramName, string contentType,
        NameValueCollection nvc)
    {
        Debug.Log(string.Format("Uploading {0} to {1}", file, url));
        string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
        byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

        HttpWebRequest wr = (HttpWebRequest) WebRequest.Create(url);
        wr.ContentType = "multipart/form-data; boundary=" + boundary;
        wr.Method = "POST";
2019-01-12

Graphy is a tool which won Unity 2018 Rewards - Best development tool.

The Debugger:

this component is a powerful feature that allows you to set a number of conditions, that, if met, will start a chain of actions defined by you. It's designed around Debug Packets. Each Debug Packet can have different conditions and actions.

  • Common parameters:
    • Active: If not active, it will be skipped when the debugger checks Debug
      Packets.
    • ID: Optional, but it’s used to operate with Debug Packets from code.
    • Execute once: If true it will only be executed once, then it will delete itself.
    • Init sleep time: Time to wait before checking this Debug Packet.
    • Sleep time after execute: Only applies if “Execute Once” is false. Time to
      wait before checking this Debug Packet after it’s been executed.
2018-12-25

half4 mix(half4 x,half4 y,float a){
	return x * (1-a) + y*a;
}

half3 rgb2hsv(half3 c) 
{ 
	half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 
	half4 p = mix(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g));
	half4 q = mix(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r)); 
	
	half d = q.x - min(q.w, q.y); 
2018-12-23

General

  • Using a more poweful machine to build with better CPU and better SSD for storing your unity project.
  • Exclude project and target build folders from anti-malware software scans
    • You can improve build times by disabling anti-malware software before building your project. (Testing by Unity Technologies found that build times decreased by 50 – 66% after disabling Windows Defender on a fresh Windows 10 installation.)
  • Put your codes which not often changed to the Plugin directory

New version Unity

2018-12-20
Display Git Branch in bash prompt
git_branch() {
	branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
	if [ "${branch}" != "" ];then
		if [ "${branch}" = "(no branch)" ];then
			branch="(`git rev-parse --short HEAD`...)"
		fi
		echo " ($branch)"
	fi
}

export PS1='\[\033[34;34m\]\[email protected]\t\[\033[34;32m\] \w\[\033[00m\]\033[34m$(git_branch)\033[00m \$ '
2018-12-18
using System;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Text;
using UnityEngine;

namespace Assets.PipelineGenerator.Scripts.ESRI.ShapeImporter
{
    /// <summary>
    /// Enumeration defining the various shape types. Each shapefile
2018-12-18
using System;
using UnityEngine;
using System.Collections;
using System.IO;


public class CapturePhoto : MonoBehaviour
{
    private static Texture2D tex2D;
    private bool startCapture;
    private string finalPath;
2018-12-18

AsyncOperation

using System.Collections;
using UnityEngine;

[ExecuteInEditMode]
public class ExampleClass : MonoBehaviour
{
    public void Start()
    {
        StartCoroutine(Example_AsyncTests());
    }

    public IEnumerator Example_AsyncTests()
    {
2018-12-15

Simple ease script in C#:


using UnityEngine;

public enum EaseType
{
	bounce,
	InSine,
	InOutSine,
	InOutExpo,
	InOutCirc,
	InQuad,
	OutQuad,
2018-12-14

Blizzard China is seeking a hands-on technical Manager to join and lead our Data center team. The DC team goal is to maintain and optimize our Data Centers to support Blizzard IT systems and services including player facing and internal customer facing with epic experience. The candidate must be a dedicated problem solver who can work independently, multitask and prioritize things in a fast-paced and demanding environment This position will be based in Shanghai and reported to Operations Director, Blizzard China.

Responsibilities

  • Managing data center engineers and admins, communicating with global data center peers on daily operations and project implementations, as well as working closely with our China partners on data center long-haul strategy and management
  • Responsible to build and maintain world-class data centers in China including DC facility management and new DC selection
  • Plan and manage infrastructure resources cabling, hardware, racks, etc in complex sites
  • Guide the hardware installation, manage the firmware version in automatic way
  • Owner of DC policies/enforcement, DCIM, network diagram, IDC infrastructure topology and deploy guide
  • Participate in the scheduled server maintenances with system engineers and dev teams
  • Work independently on DC optimization and daily operations, and other tasks from the Operations Director

Requirements

  • Expert experience with DC industry standards which covering power supply methodology, efficient cooling system, modern cabling, system/ environment automation & monitoring
  • Hands-on and field experience with medium to large-scale hardware deployment, installation and troubleshooting, especially on Dell, HP and Cisco blade systems
2018-12-12

Using Unity Editor to deploy firebase hosting site content:

        string path = System.Environment.GetEnvironmentVariable("PATH") + @":/usr/local/bin";
		System.Environment.SetEnvironmentVariable("PATH", path);
		//		UnityEngine.Debug.Log(path);

		process = new Process();
		process.StartInfo.UseShellExecute = false;
		process.StartInfo.RedirectStandardOutput = true;
		process.StartInfo.RedirectStandardError = true;
		process.StartInfo.FileName = "/bin/bash";
		process.StartInfo.CreateNoWindow = true;
		process.StartInfo.WorkingDirectory = Application.dataPath.Substring(0,Application.dataPath.Length-7)+"/Exports";
2018-12-12

👏 欢迎使用 Gridea
✍️ Gridea 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...

2018-12-01
var request = require('sync-request')
var api_root = "https://api.cloudflare.com/client/v4/";

function createDNSrecord(projID, srcUrl) {
    var options = {
        url: api_root + "zones/XXXXXX/dns_records",
        headers: {
            "Content-Type": "application/json",
            "X-Auth-Email": "[email protected]",
            "X-Auth-Key": "XXXX"
        },
        json: {
2018-12-01

I'm using firmware form http://firmware.koolshare.cn/LEDE_X64_fw867/

Their softcenter's resources not same with LEDE luci, so I record my nginx config file here.

user root root;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        lo:gs/nginx.pid;