Skip to content

Instantly share code, notes, and snippets.

View heejune's full-sized avatar

Heejune heejune

View GitHub Profile
@heejune
heejune / gist:1e75b323e596eaafa21f
Created May 24, 2015 13:22
Mixing CRT link type will cause debug assert when it freed
if (pHead->pBlockHeaderPrev)
{
pHead->pBlockHeaderPrev->pBlockHeaderNext = pHead->pBlockHeaderNext;
}
else
{
_ASSERTE(_pFirstBlock == pHead);
_pFirstBlock = pHead->pBlockHeaderNext;
}
@heejune
heejune / gist:05e1dccc33943d193352
Created May 24, 2015 13:25
cpprestsdk json test
#include <cpprest\json.h>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
{
web::json::value root;
std::wstring filepath = L"config.json";
std::ifstream ifs;
@heejune
heejune / output.log
Created December 7, 2015 00:40
LNK2019 error message while linking QT with static lib
2>xxxwidget.obj : error LNK2019: unresolved external symbol "void __cdecl yyy::zzzstring(...)" (?zzzstring@xxx@@YAXPAU_GUID@@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z) referenced in function __catch$?nnn@mmm@@...... :
fatal error LNK1120: 1 unresolved externals
@heejune
heejune / build.py
Created December 7, 2015 15:14
Launch a msbuild=
# Sample code snippet..
def start(self, version):
msbuild = os.getenv('MSBUILD_PATH', r"C:\Program Files\MSBuild\12.0\Bin\MSBuild.exe")
project_output_dir = os.getenv('PROJECT_OUTPUT_DIR', r'c:\Build_distribute\')
if not os.path.exists(msbuild):
raise Exception('not found ' + msbuild)
projects = [r"..\yoursolution.sln", r"..\yourproject\yourproject.vcxproj"]
@heejune
heejune / manage_version.py
Created December 7, 2015 15:19
Specify the version at .rc resource file
# source taken from
# http://stackoverflow.com/questions/4003725/modifying-rc-file-with-python-regexp-involved
# target_version = "2,3,4,5"
def set_rc_version(rcfile, target_version):
with open(rcfile, "r+") as f:
rc_content = f.read()
# first part
@heejune
heejune / setup-orgmode.el
Created March 5, 2016 04:08
orgmode XeLaTex override example
(eval-after-load 'org
(lambda()
(require 'ob-C)
(require 'org-bullets)
(require 'ox-taskjuggler)
(require 'ox-latex)
;; …
(setq org-latex-to-pdf-process
@heejune
heejune / ocr_bot.py
Created January 26, 2016 01:08
telegram bot example uses the tesseract to process OCR request
import sys
import asyncio
import random
import telepot
from telepot.delegate import per_chat_id
from telepot.async.delegate import create_open
import os
import traceback
@heejune
heejune / PDFFile_webbrowser_invoke.cs
Created June 21, 2016 00:58
Convert the PDF file into base64 string and pass it to the webbrowser control
if (locateText.Text.EndsWith("pdf", true, null) == true &&
File.Exists(locateText.Text) == true)
{
var buffer = File.ReadAllBytes(locateText.Text);
// Document.InvokeScript seems not understanding the Blob type
//object[] args = { fileBytes };
//webBrowser1.Document.InvokeScript("PDFViewerApplication.open", args);
// so convert it to base64 and pass it
@heejune
heejune / invoke_pdfjs_viewer_with_base64.js
Created June 21, 2016 01:01
Open PDFjs as base64 string
// https://github.com/heejune/WinForm-PDFjs/blob/master/WinFormPDFViewer/pdfjs-1.4.20-dist/web/viewer.js
// PDFViewerApplication.open wrapper for base64 param
window.openPdfAsBase64 = function (base64) {
var binary_string = window.atob(base64);
var len = binary_string.length;
var bytes = new Uint8Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
@heejune
heejune / CMaktLists.txt
Created August 17, 2016 01:45
CMakeLists.txt for clang standalone tool
## http://qiita.com/Chironian/items/8770c8ab833086fb51a9
############################################################
# base
############################################################
cmake_minimum_required(VERSION 2.8.8)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
set(CMAKE_SUPPRESS_REGENERATION TRUE)