Skip to content

Instantly share code, notes, and snippets.

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
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Web.Http.ModelBinding;
namespace MyApi.Filters
{
:: Disable dashboard on macOS
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
static class Program
{
static void Main()
{
var servicesToRun = new ServiceBase[] { new YourService() };
// Run as service
if (!Environment.UserInteractive)
{
ServiceBase.Run(servicesToRun);
@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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using Newtonsoft.Json;
namespace Newtonsoft.Json.Serialization
{
/// <summary>
@jhlee8804
jhlee8804 / default_configurations.ps1
Created August 2, 2017 16:15
Default configurations
# powershell 출력 인코딩을 ASCII -> UTF8로 변경
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
<?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);
:: How to on/off the Hyper-v
$ bcdedit /set hypervisorlaunchtype [auto|off]