Skip to content

Instantly share code, notes, and snippets.

🎓

huihut huihut

🎓
Block or report user

Report or block huihut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huihut
huihut / program_running_time.cpp
Created Aug 13, 2019
Statistical program running time
View program_running_time.cpp
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
clock_t startTime,endTime;
startTime = clock();
for (int i = 0; i < 1000000; i++)
@huihut
huihut / Screenshot.cs
Created Mar 23, 2019
Unity TakeScreenshot
View Screenshot.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Screenshot : MonoBehaviour
{
private int index = 0;
// Start is called before the first frame update
void Start()
@huihut
huihut / Screenshot.cs
Created Mar 23, 2019
Unity TakeScreenshot
View Screenshot.cs
// <http://wiki.unity3d.com/index.php?title=TakeScreenshot>
// ****** Notice : It doesn't works in Wep Player environment. ******
// ****** It works in PC environment. ******
// Default method have some problem, when you take a Screen shot for your game.
// So add this script.
// CF Page : http://technology.blurst.com/unity-jpg-encoding-javascript/
// made by Jerry ( sdragoon@nate.com )
using UnityEngine;
@huihut
huihut / TakeScreenshot.cs
Created Mar 23, 2019
Unity TakeScreenshot
View TakeScreenshot.cs
// <http://wiki.unity3d.com/index.php?title=TakeScreenshot>
// TODO:
// By default, screenshot files are placed next to the executable bundle -- we don't want this in a
// shipping game, as it will fail if the user doesn't have write access to the Applications folder.
// Instead we should place the screenshots on the user's desktop. However, the ~/ notation doesn't
// work, and Unity doesn't have a mechanism to return special paths. Therefore, the correct way to
// solve this is probably with a plug-in to return OS specific special paths.
// Mono/.NET has functions to get special paths... see discussion page. --Aarku
@huihut
huihut / SQLiteHelper.cs
Created Mar 18, 2019
C# SQLiteHelper 数据库操作类
View SQLiteHelper.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
/// <summary>
/// 数据库操作类
/// </summary>
public sealed class SQLiteHelper
{
@huihut
huihut / UnityPlatform.md
Last active Jan 13, 2019
Unity Platform dependent compilation
View UnityPlatform.md
@huihut
huihut / deb_mirror_sources.list
Created Dec 28, 2018
Ubuntu deb mirror sources
View deb_mirror_sources.list
## update sources
#sudo apt-get update
#sudo apt-get upgrade
## a good mirror based on your location
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
@huihut
huihut / MainWindow.xaml.cs
Last active Nov 23, 2018
WPF Create Dump
View MainWindow.xaml.cs
/*
* [MiniDumpWriteDump function](https://docs.microsoft.com/zh-cn/windows/desktop/api/minidumpapiset/nf-minidumpapiset-minidumpwritedump)
* [_MINIDUMP_TYPE Enumeration](https://docs.microsoft.com/zh-cn/windows/desktop/api/minidumpapiset/ne-minidumpapiset-_minidump_type)
* [Programmatically Generating a Dump File](http://blogs.microsoft.co.il/sasha/2008/05/28/programmatically-generating-a-dump-file/)
* [Create your own crash dumps](https://blogs.msdn.microsoft.com/calvin_hsia/2015/08/31/create-your-own-crash-dumps/)
*/
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
@huihut
huihut / UWPGetInfo.cs
Last active Nov 22, 2018
UWP get Device, OS and App info
View UWPGetInfo.cs
/*
https://www.suchan.cz/2015/08/uwp-quick-tip-getting-device-os-and-app-info/
https://docs.microsoft.com/zh-cn/windows/desktop/api/winnt/ns-winnt-_osversioninfoa
https://social.msdn.microsoft.com/Forums/WINDOWS/en-US/6d754895-36c0-403d-a91d-f0efbc1f36a8/uwphow-to-retrieve-os-version-in-a-universal-app?forum=wpdevelop
*/
using Windows.ApplicationModel;
using Windows.Security.ExchangeActiveSyncProvisioning;
using Windows.System.Profile;
...
@huihut
huihut / MD5_SHA1_encrypt.cs
Created Oct 26, 2018
C# MD5 and SHA1 encrypt
View MD5_SHA1_encrypt.cs
// MD5
public static string Md5(string str)
{
var algorithm = HashAlgorithmNames.Md5;
HashAlgorithmProvider provider = HashAlgorithmProvider.OpenAlgorithm(algorithm);
var hash = provider.CreateHash();
IBuffer buffer = CryptographicBuffer.ConvertStringToBinary(str, BinaryStringEncoding.Utf16LE);
hash.Append(buffer);
var hashedBuffer = hash.GetValueAndReset();
return CryptographicBuffer.ConvertBinaryToString(BinaryStringEncoding.Utf16LE, hashedBuffer);
You can’t perform that action at this time.