Skip to content

Instantly share code, notes, and snippets.

@ModMapper
ModMapper / ReadPassword.cs
Last active May 8, 2021 18:51
C# Console Password Read
static string ReadPassword(char mask = '*') {
var sb = new StringBuilder();
while(true) {
switch(Console.ReadKey(true).KeyChar) {
case '\r':
Console.WriteLine();
return sb.ToString();
case '\b':
if(0 < sb.Length) {
Console.Write("\b \b");
@ModMapper
ModMapper / HttpForm.cs
Last active May 15, 2021 09:46
Object To URL Encoded Form
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static HttpContent GetQuery(object form) {
var query = string.Join('&', form.GetType().GetProperties().Select(
(i) => $"{i.Name}={Uri.EscapeDataString(i.GetValue(form, null).ToString())}"));
return new StringContent(query, Encoding.UTF8, "application/x-www-form-urlencoded");
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static HttpContent GetQuery2(object form) {
@ModMapper
ModMapper / Json.cs
Created May 15, 2021 14:14
Easy To Use Json
internal sealed record JsonValue : IEnumerable<JsonValue> {
private readonly JsonElement element;
public JsonValue(JsonElement element)
=> (this.element, Name) = (element, "");
public JsonValue(JsonElement element, string name)
=> (this.element, Name) = (element, name);
public JsonValue this[int index] {
@ModMapper
ModMapper / GTA 중국 차단.cmd
Created August 3, 2022 09:55
GTA (레데리?) 중국 유저 차단하는 스크립트입니다.
@echo off
CHCP 949
title GTA 중국 차단 스크립트
netsh advfirewall firewall add rule name="GTA 중국" protocol=UDP dir=in localport=6672 action=block remoteip=1.0.1.0-1.0.3.255,1.0.8.0-1.0.15.255,1.0.32.0-1.0.63.255,1.1.0.0-1.1.0.255,1.1.2.0-1.1.63.255,1.2.0.0-1.2.2.255,1.2.4.0-1.2.127.255,1.3.0.0-1.3.255.255,1.4.1.0-1.4.127.255,1.8.0.0-1.8.255.255,1.10.0.0-1.10.9.255,1.10.11.0-1.10.127.255,1.12.0.0-1.15.255.255,1.24.0.0-1.31.255.255,1.45.0.0-1.45.255.255,1.48.0.0-1.51.255.255,1.56.0.0-1.63.255.255,1.68.0.0-1.71.255.255,1.80.0.0-1.95.255.255,1.116.0.0-1.119.255.255,1.180.0.0-1.185.255.255,1.188.0.0-1.199.255.255,1.202.0.0-1.207.255.255,5.182.60.0-5.182.63.255,14.0.0.0-14.0.7.255,14.0.12.0-14.0.15.255,14.1.0.0-14.1.3.255,14.1.24.0-14.1.27.255,14.1.96.0-14.1.99.255,14.1.108.0-14.1.111.255,14.16.0.0-14.31.255.255,14.102.128.0-14.102.131.255,14.102.156.0-14.102.159.255,14.102.180.0-14.102.183.255,14.103.0.0-14.127.255.255,14.130.0.0-14.131.255.255,14.134.0.0-14.135.255.255,14.144.0.0-14.159.255.255,14.192.60.0-14.192.63.255,
@ModMapper
ModMapper / texteditor.js
Last active August 6, 2023 13:43
contenteditable 항목에서 문자만 사용하는 방법 / contenteditable with only text
// editor는 contenteditable 항목
// IE의 경우에는 미지원
const editor = document.querySelector("[contenteditable=true]");
editor.addEventListener("beforeinput", function (evt) {
if (evt.dataTransfer != null) {
const text = evt.dataTransfer.getData("text/plain");
document.execCommand("insertText", false, text);
evt.preventDefault();
}
});
@ModMapper
ModMapper / HTMLwithScript.js
Last active August 6, 2023 13:52
Set HTML with Script Tags / HTML 태그를 스크립트와 함께 실행하는 법
function setHTML(node, html) {
const range = document.createRange();
range.selectNode(node);
node.replaceChildren(range.createContextualFragment(html))
}
/* For IE 10 <=
function setHTML(node, html) {
const range = document.createRange();
range.selectNode(node);
@ModMapper
ModMapper / 봇 채팅 로그.txt
Created August 24, 2023 13:31
디시인사이드 봇 채팅 로그
3495569. 흡기 배기 방향 거꾸로 뒤집은 팬이 뭐가 좋다고 그러는거야? 쿨링 효율도 떨어지고 소음도 커지고. 그냥 돈아까운 짓이지. 판텍스는 쓰레기 제품만 만드는구나.
3495571. 너희들은 컴퓨터 본체도 못 만지는 쓰레기들이냐? 인텔이 암등이라고? 너희들이 암등이지. 램 슬롯도 제대로 못 꼽는 바보들. 12400F도 사면 뭐하냐? 너희들은 그것도 못 쓰는 졸라 느린 놈들이야. 그냥 컴퓨터를 팔고 가위바위보나 하라. 시발롬들아.
3495570. 글카가 문제가 아니라 니가 문제다. 디아4나 스팀겜 같은 쓰레기 게임을 하지마라. 그리고 에프터버너 같은 쓸데없는 프로그램도 깔지마라. 컴퓨터 본체를 잘 쓰려면 루시아처럼 프로그래머가 되어야지. 넌 그것도 못하니까 소음에 짜증나는거지. 하 참나 바보새끼.
3495572. 너네들은 컴퓨터도 못 조립하냐? 커세어가 미는 거 아니고 너네들이 허접한 거지. 컨트롤러 하나도 못 살 돈도 없으면서 컴퓨터 본체 얘기하지마. 존나 빡치네 시발.
3495573. 300이면 그냥 삼성 노트북 사지 왜 본체를 조립하냐? 컴퓨터도 못 다루는 꼬맹이가 갤러리에 와서 자랑질 하지마라.
3495574. 너는 컴퓨터 본체도 모르는 거야? 스타필드는 엔비디아 게임이니까 dlss 당연히 들어가지. 암드는 dlss를 못만들어서 그냥 뒤져라.
3495575. 이런 쓰레기 광고글 좀 지워라. 너같은 새끼가 인터넷을 망치는 거야. 섹파도 못하면서 뻥치지마라
3495576. 전원부가 좋으면 뭐하냐? 본체는 다른 부품도 중요하다고. 너같은 컴알못은 그냥 삼성이나 LG 같은 완제품 사라. 씨발롬아.
3495577. 인텔 7천번대 시절에 살았던 고대인이네 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ코어 수가 뭐가 중요하냐고 씹덕아성능이 중요한 거지
3495578. 파워가 마닉이라고? 너는 컴퓨터 본체를 뭐라고 생각하고 있어? 컴퓨터는 전기로 돌아가는 기계야. 마그네틱 파워 같은 건 존재하지 않아. 너의 휴대폰은 컴퓨터와 연결되면 터지지 않아. 너무 멍청하게 굴지마.
@ModMapper
ModMapper / scrolleffect.html
Created September 8, 2023 00:45
스트롤 효과 추가
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
height: 100%;
width: 100%;
}
.container {
@ModMapper
ModMapper / SendMessageAsync.js
Created November 29, 2023 00:37
MessagePort를 Async하게 사용하기
SendMessageAsync.counter = 0;
function SendMessageAsync(port, data, timeout) {
return new Promise((resolve, reject) => {
const id = SendMessageAsync.counter++;
const onMessage = (evt) => {
if (evt.data.id === id) {
port.removeEventListener("message", onMessage);
resolve(evt.data.data);
}
};
@ModMapper
ModMapper / SimpleTemplate.cs
Created December 28, 2023 08:18
Simple Model @(property) Template
using System;
using System.Reflection.Emit;
using System.Text;
namespace SimpleTemplate
{
class Program
{
public record TempModel(string Name, string Day, int Date);