Skip to content

Instantly share code, notes, and snippets.

@jhlee8804
jhlee8804 / default_configurations.ps1
Created August 2, 2017 16:15
Default configurations
# powershell 출력 인코딩을 ASCII -> UTF8로 변경
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@jhlee8804
jhlee8804 / mssql.bat
Created August 8, 2017 04:44
Run microsoft/mssql-server-linux on docker
# image: https://hub.docker.com/r/microsoft/mssql-server-linux/
# cf. https://docs.microsoft.com/ko-kr/sql/linux/quickstart-install-connect-docker
# linux/macOS
$ docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' -e 'MSSQL_PID=Developer' --cap-add SYS_PTRACE -p 1433:1433 -d microsoft/mssql-server-linux
# windows
$ docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>" -e "MSSQL_PID=Developer" --cap-add SYS_PTRACE -p 1433:1433 -d microsoft/mssql-server-linux
@jhlee8804
jhlee8804 / coinone_chat_shrink.js
Last active November 6, 2017 15:09
코인원 채팅 메시지 개수 줄이기
var $chatList = $('.chat_list');
if ($chatList.length > 0) {
setInterval(function () {
var controller = angular.element($chatList).scope(),
messages = controller.messages,
count = messages.length,
limit = 100;
if (count > limit) {
var offset = count - limit;
$ lsof -n -i4TCP:$PORT | grep LISTEN
$ lsof -n -iTCP:$PORT | grep LISTEN
$ lsof -n -i:$PORT | grep LISTEN
@jhlee8804
jhlee8804 / slimdown.js
Created June 9, 2018 16:42 — forked from renehamburger/slimdown.js
slimdown.js
'use strict';
/**
* Javascript version of https://gist.github.com/jbroadway/2836900
*
* Slimdown - A very basic regex-based Markdown parser. Supports the
* following elements (and can be extended via Slimdown::add_rule()):
*
* - Headers
* - Links
@jhlee8804
jhlee8804 / content-editable.js
Last active June 3, 2023 00:58
Get contenteditable plaintext with correct linebreaks
/**
* @see {@link https://stephenhaney.com/2020/get-contenteditable-plaintext-with-correct-linebreaks}
* @see {@link https://github.com/StephenHaney/stephenhaney/issues/6}
*/
function parseValueFromContentEditable(e) {
let newValue = ''
let isOnFreshLine = true
function parseChildNodesForValueAndLines(childNodes) {
for (let i = 0; i < childNodes.length; i++) {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Newtonsoft.Json.Serialization
{
/// <summary>
/// Keep casing when serializing dictionaries
/// cf. https://stackoverflow.com/a/24226442/3781540
static class Program
{
static void Main()
{
var servicesToRun = new ServiceBase[] { new YourService() };
// Run as service
if (!Environment.UserInteractive)
{
ServiceBase.Run(servicesToRun);
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="logs/nlog-internal.log">
<!-- cf. https://github.com/NLog/NLog/wiki/Layout-Renderers -->
<variable name="default_layout"
value="${time} [${logger}(L\:${callsite-linenumber})] ${uppercase:${level}} (TID\:${threadid}) ${message}${onexception:${newline}${exception:format=ToString}}" />
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace System
{
public static class EnumExtensions
{
private static readonly ConcurrentDictionary<string, string> _enumToValueMap
= new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase);