Skip to content

Instantly share code, notes, and snippets.

View Bak-Jin-Hyeong's full-sized avatar

Bak, Jin Hyeong Bak-Jin-Hyeong

View GitHub Profile
@Bak-Jin-Hyeong
Bak-Jin-Hyeong / abseil-cpp.natvis
Last active August 13, 2019 05:03
visual studio 2015 debug visualizer for google abseil-cpp
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="absl::lts_2019_08_08::InlinedVector&lt;*&gt;">
<DisplayString>{{ size={storage_.metadata_.value >> 1} }}</DisplayString>
<Expand>
<Item Name="[N]" ExcludeView="simple">sizeof(storage_.data_.inlined.inlined_data) / sizeof(storage_.data_.inlined.inlined_data[0])</Item>
<Item Name="[allocator]" ExcludeView="simple">storage_.metadata_</Item>
<Item Name="[capacity]" ExcludeView="simple" Condition="(storage_.metadata_.value &amp; 1) == 0">$T2</Item>
<Item Name="[capacity]" ExcludeView="simple" Condition="(storage_.metadata_.value &amp; 1) == 1">storage_.data_.allocated.allocated_capacity</Item>
<IndexListItems Condition="(storage_.metadata_.value &amp; 1) == 0">
#include "jsmn.h"
struct JSMN_Verify_Stack_Element
{
int offset;
int num_tokens;
};
int JSMN_Verify(const jsmntok_t* tokens, const JSMN_Verify_Stack_Element param)
{
#ifndef APPEND_UNESCAPED_JSON_STRING__HPP__
#define APPEND_UNESCAPED_JSON_STRING__HPP__
//
// usage:
//
// const char json[] = u8"유티엪후-8! XYZ, \\uAC00, \\uD600\\uc5c9, QVW \\u0X 유티엪후-8!, 써로게이트 \\uD83D\\uDCA9 페어!";
// const auto json_length = strlen(json);
// std::string s;
// append_unescaped_json_string(json, json_length, [&s](auto c) {
@Bak-Jin-Hyeong
Bak-Jin-Hyeong / AbseilInlinedVector.h
Last active September 4, 2018 00:02
#include <absl/container/inlined_vector.h> without defining _SCL_SECURE_NO_WARNINGS globally.
#ifndef ABSEILINLINEDVECTOR__H__
#define ABSEILINLINEDVECTOR__H__
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <initializer_list>
$GOPATH = 'C:\BlahBlahBlah\Blah'
$GOPATH_BIN = "$GOPATH\bin"
$env:GOPATH = $GOPATH
if ($env:Path.IndexOf($GOPATH_BIN, [StringComparison]::OrdinalIgnoreCase) -lt 0)
{
if (($env:Path.Length -eq 0) -or ($env:Path[$env:Path.Length - 1] -eq ';'))
{
$env:Path += "$GOPATH_BIN"
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold red)%h%C(reset) : %C(bold green)(%ai)%C(reset) - %C(cyan)%an <%ae>%C(reset)%C(bold yellow)%d%C(reset)%n%n%w(90,1,2)%C(white)%B%C(reset)%n'"
git config --global alias.lg1 "log --graph --abbrev-commit --decorate --format=format:'%C(bold red)%h%C(reset) : %C(bold green)(%ai)%C(reset) - %C(cyan)%an <%ae>%C(reset)%C(bold yellow)%d%C(reset)%n%n%w(90,1,2)%C(white)%B%C(reset)%n' --oneline"
[user]
email = noreply@anonymous
name = noname
[core]
editor = code --wait
autocrlf = false
pager = diff-so-fancy | less --tabs=4 -RFX
[commit]
cleanup = scissors
[merge]
@Bak-Jin-Hyeong
Bak-Jin-Hyeong / Use-Python36.ps1
Created August 10, 2018 12:12
Add the path of the Python interpreter to the Windows PATH environment variable.
$PythonPath = Resolve-Path '~\AppData\Local\Programs\Python\Python36'
$ScriptsPath = Join-Path $PythonPath 'Scripts'
if ($env:Path.Split(';') | Select-String -Pattern $PythonPath -SimpleMatch)
{
exit 0
}
$env:Path += ';' + $PythonPath
$env:Path += ';' + $ScriptsPath
@Bak-Jin-Hyeong
Bak-Jin-Hyeong / cp949_to_utf8.cpp
Last active December 18, 2018 02:22
cp949_to_utf8
#include "cp949_to_utf8.h"
#include <cstdlib>
CP949_to_UTF8_Length
cp949_to_utf8_length(const char* cp949_data, size_t num_cp949_bytes)
{
CP949_to_UTF8_Length result{};
for (size_t i = 0; i < num_cp949_bytes; ++i)
{
GET / HTTP/1.1
X-Forwarded-Proto: http
X-Forwarded-Port: 80
X-Amzn-Trace-Id: Root=1-5c7628a8-84d63ad8fb4fa07ad8752c46
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 71.6.232.4