Skip to content

Instantly share code, notes, and snippets.

testgist
using GMTool.Sources.Config;
using GMTool.Sources.Data;
using GMTool.Sources.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace GMTool.Sources.Util
using System.Runtime.InteropServices;
namespace GMTool.Sources.Util
{
// 서비스 컨트롤 할때 원격에 있는 경우 아래 기능이 필요하다. 또는 원격에 있는 네트워크 드라이브 연결할때도 사용하면됨
// http://www.pinvoke.net/default.aspx/mpr.wnetaddconnection2
public class NetworkDrive
{
public enum ResourceScope
@jungrok5
jungrok5 / kanpsack.py
Created October 27, 2016 15:41 — forked from suminb/kanpsack.py
이상한 호주 여행기 - 비용 정산 편에 소개 된 배낭 문제 코드입니다.
values = [
16199, 10906, 3382, 84725, 71294, 36372, 21256, 18555, 21636, 19425, 18688,
10482, 7613, 74453, 58176, 50942, 26950, 26582, 9589, 9520, 210198, 50818,
36992, 17732, 16953, 9971, 8031, 5247, 372309]
limit = 312967
def m(i, limit, values, taken, cache):
"""Calculates the maximum value that can be attained with total value less
than or equal to `limit`.
@jungrok5
jungrok5 / Guard.cs
Created March 15, 2018 07:37 — forked from derrickturk/Guard.cs
A (kind of cruddy) scope guard for C#. The T: class constraint can be dropped at the expense of the null check.
class Guard<T> : IDisposable where T : class {
public Guard(T obj, Action<T> dispose)
{
obj_ = obj;
dispose_ = dispose;
disposed_ = false;
}
public void Dispose()
@jungrok5
jungrok5 / zigzag-encoding.README
Created April 14, 2020 18:00 — forked from mfuerstenau/zigzag-encoding.README
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
@jungrok5
jungrok5 / Half.cs
Created July 22, 2020 11:03 — forked from vermorel/Half.cs
C# Half-precision data type
/// ================ Half.cs ====================
/// The code is free to use for any reason without any restrictions.
/// Ladislav Lang (2009), Joannes Vermorel (2017)
using System;
using System.Diagnostics;
using System.Globalization;
namespace SystemHalf
{
@jungrok5
jungrok5 / CompilingCSharpCode.cs
Created September 29, 2021 14:07 — forked from RickStrahl/CompilingCSharpCode.cs
A few different approaches to dynamically execute C# code dynamically at runtime from a string of code.
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
using Mono.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
@jungrok5
jungrok5 / index.html
Created December 21, 2021 13:19
Three.js+ImGui JavaScript
<canvas id="output" tabindex="1"></canvas>