Skip to content

Instantly share code, notes, and snippets.

View dinowang's full-sized avatar
charging

Dino Wang dinowang

charging
View GitHub Profile
@dinowang
dinowang / update-dotnet-tool.sh
Created November 17, 2023 04:51
Update all dotnet tool
#!/bin/bash
for t in $(dotnet tool list -g | awk 'NR>2 {print $1}');
do
dotnet tool update -g $t
done
@dinowang
dinowang / microsoft-docuemnts-language-switcher.js
Last active April 6, 2020 06:58
Microsoft docuemnts language (en-us/zh-tw/zh-cn) switcher
// ==UserScript==
// @name Microsoft docuemnts language (en-us/zh-tw/zh-cn) switcher
// @namespace http://dinowang.net/
// @version 0.1
// @description
// @author Dino Wang
// @match https://*.microsoft.com/*/*
// @match https://*.azure.cn/*/*
// @grant none
// ==/UserScript==
<?xml version="1.0" encoding="UTF-8"?>
<Landscape updated="2020-03-18T04:11:30Z" version="1" generator="SAP GUI for Windows v7600.1.4.154">
<Includes>
<Include url="https://gist.github.com/dinowang/b80427e0928c9b7f37d19095169d5980/raw/SAPUILandscapeGlobal.xml" index="0" />
</Includes>
<Workspaces>
<Workspace uuid="f390e047-d61a-414d-b543-020ccce3eef9" name="DEMO">
<Item uuid="3d789ef8-af5c-4d73-a62d-8f988e71bb39" serviceid="d94315fb-19c4-4d6f-8657-51cd73b842eb" />
</Workspace>
</Workspaces>
@dinowang
dinowang / search-engine-switcher.js
Last active March 16, 2020 14:41
Search engine (google | bing | duckduckgo) switcher for Tampermonkey
// ==UserScript==
// @name Search engine (google | bing | duckduckgo) switcher
// @namespace http://dinowang.net/
// @version 0.1
// @description
// @author Dino Wang
// @match https://*.google.com/search*
// @match https://*.google.com.tw/search*
// @match https://*.bing.com/search*
// @match https://duckduckgo.com/*
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Util;
az resource list | curl -H "Content-Type: application/json" -X POST -d @- http://localhost:5000/Home/Recv
@dinowang
dinowang / index.html
Last active October 9, 2018 13:03
whack-a-mole
<div id="game">
<div id="playground">
</div>
<div id="score">
<h2 class="text-danger">Scoreboard</h2>
<h3>
<span class="text-info">Your score: <span>
<span id="current-score" class="scores">0</span>
</h3>
<h3>
@dinowang
dinowang / StrToHex.cs
Last active June 20, 2018 09:15
C# convert string to hexadecimal string
var str = "1234中文";
var hex = string.Join("", Encoding.GetEncoding("BIG5").GetBytes(str).Select(x => $"{x:X2}"));
// hex = "31323334A4A4A4E5"
@dinowang
dinowang / Main.m
Last active December 29, 2020 16:16
Objective-C program upload file to Azure Blob Storage with progress indicator
#import <AZSClient/AZSClient.h>
NSString *const AZURE_STORAGE_CONNECTION_STRING = @"DefaultEndpointsProtocol=https;AccountName=(your account name);AccountKey=(your account key);EndpointSuffix=core.windows.net";
NSString *const AZURE_STORAGE_CONTAINER = @"files";
NSString *const LOCAL_FILE_FILEPATH = @"/Users/dino/A.mp4";
NSString *const LOCAL_FILE_FILENAME = @"A.mp4";
NSError *error;
AZSCloudStorageAccount *account = [AZSCloudStorageAccount accountFromConnectionString:AZURE_STORAGE_CONNECTION_STRING error:&error];
AZSCloudBlobClient *client = [account getBlobClient];
@dinowang
dinowang / Main.java
Last active April 2, 2021 22:05
Java program upload file to Azure Blob Storage with progress indicator
package com.cloudriches.sample;
import com.microsoft.azure.storage.CloudStorageAccount;
import com.microsoft.azure.storage.blob.CloudBlobClient;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
import com.microsoft.azure.storage.blob.CloudBlockBlob;
import java.io.File;
import java.io.FileInputStream;