This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Text; | |
using Microsoft.Data.SqlClient; | |
Console.Write("Login Id : "); | |
string loginId = Console.ReadLine() ?? string.Empty; | |
int UseFl = 1; | |
SqlQueryHandler handler = $"SELECT * FROM Users WHERE LoginId = {loginId.Trim()} AND UseFl = {UseFl}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Claims; | |
using System.Text.Encodings.Web; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.Extensions.Options; | |
public class SessionAuthenticationHandler : SignInAuthenticationHandler<SessionAuthenticationOptions> | |
{ | |
public SessionAuthenticationHandler(IOptionsMonitor<SessionAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder) | |
: base(options, logger, encoder) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createScheduler(callback, interval = 5000) { | |
let timerId = setTimeout(scheduleNext, interval); // 타이머 시작 | |
return { run, stop }; | |
function stop() { | |
clearTimeout(timerId); // 타이머 종료 | |
timerId = null; // 타이머 초기화 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getResponseFileName(res : Response) : string { | |
return getContentFileName(res.headers.get('content-disposition')) || getURLFileName(res.url); | |
function getContentFileName(contentDisposition : string) { | |
if (!contentDisposition) return null; | |
const pattern = /filename\*=UTF-8''([^"';\n]+)|filename[^;\n=]*=["']?([^"';\n]+)["']?/; | |
const matches = contentDisposition.match(pattern); | |
if (matches) { | |
if (matches[1]) { | |
return decodeURIComponent(matches[1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Buffers.Binary; | |
using System.Net; | |
using System.Net.Sockets; | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var ep = FetchGoogleStunAsync().Result; | |
Console.WriteLine(ep.Port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Threading.Tasks; | |
public class SimpleCache<T> | |
{ | |
public SimpleCache(TimeSpan expiry, Func<string, T> dataRetriever) | |
{ | |
Expiry = expiry; | |
DataRetriever = dataRetriever; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TkUtils = { | |
escape: { | |
regex(value) { | |
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
}, | |
}, | |
parse: { | |
boolean(value) { | |
return String(value).toLowerCase() === 'true'; | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[\s\S]*?(-->|$)|<script+([\s\/]+([^=>\s\/]+\s*=\s*("[^"]*"|'[^']*'|[^">\s\/][^>\s\/]*)|[^=>\s\/]+))*[\s\/]*>[\s\S]*?(<\/script+([\s\/]+([^=>\s\/]+\s*=\s*("[^"]*"|'[^']*'|[^">\s\/][^>\s\/]*)|[^=>\s\/]+))*[\s\/]*>|$)|<style+([\s\/]+([^=>\s\/]+\s*=\s*("[^"]*"|'[^']*'|[^">\s\/][^>\s\/]*)|[^=>\s\/]+))*[\s\/]*>[\s\S]*?(<\/style+([\s\/]+([^=>\s\/]+\s*=\s*("[^"]*"|'[^']*'|[^">\s\/][^>\s\/]*)|[^=>\s\/]+))*[\s\/]*>|$)|<\/?[^>\s\/]+([\s\/]+([^=>\s\/]+\s*=\s*("[^"]*"|'[^']*'|[^">\s\/][^>\s\/]*)|[^=>\s\/]+))*[\s\/]*> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
using Microsoft.AspNetCore.Mvc; | |
public class SSEActionResult(IAsyncEnumerable<SSEMessage> messages) : IActionResult | |
{ | |
public async Task ExecuteResultAsync(ActionContext context) | |
{ | |
var response = context.HttpContext.Response; | |
response.ContentType = "text/event-stream"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Utils.BigBuffers; | |
using System.Runtime.InteropServices; | |
using System.Runtime.CompilerServices; | |
using System.Buffers; | |
using System.Threading.Tasks; | |
using System.Threading; | |
public class BigBuffer<T> : IDisposable | |
{ |
NewerOlder