Skip to content

Instantly share code, notes, and snippets.

View maildrop's full-sized avatar

Mikito TOGURO maildrop

View GitHub Profile
@maildrop
maildrop / vc.bat
Last active August 18, 2020 13:35
@rem ---------------------------------------------------------------------------------------------------------
@rem Windows SDK のインストールフォルダーの自動推定
@rem エントリーポイントへ飛ぶ
goto MAIN
@rem ---------------------------------------------------------------------------------------------------------
@rem Windows SDK のインストールフォルダーの自動推定
:GUESS_SDK_FOLDER
@rem ---------------------------------------------------------------------------------------------------------
@rem Visual Studio 2017 からはvcwhereというツールを使うことができるようになった
<script type="text/javascript">
(function(){
"use strict";
const strftime = (()=>{
return function( fmt,date ){
if( !fmt ) return "";
date = (date ? date : new Date());
return fmt.replace( /%((_?)(0?)([0-9]*)([aAbBcCdDeEFGghHIjklmMnOpPrRsStTuUVwWxXyYzZ+%]))/g, function( match, p1,p2,p3,p4,p5 ){
const aweek = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
const mon = ["Jan","Feb","Mar","Apr","May" ,"Jun" ,"Jul" ,"Aug","Sept","Oct" ,"Nov","Dec"];
;;; -*- lexical-binding: t -*-
;; Emacs 27.1より後にできた w32-{set,get}-ime-open-statusを使用するactivate-func を作って mule-cmd.el のinput-method に登録する。
;; 関数が無い場合は、関数が無いので、何もしない関数を登録する。
(register-input-method "W32-IME" "Japanese"
(if (and (fboundp 'w32-set-ime-open-status)
(fboundp 'w32-get-ime-open-status))
(lambda ( &optional arg )
"input method activate function that using w32-set-ime-open-status"
(if arg
(()=>{
let l = 1;
let pobj = new Promise( ( resolve , reject )=>{
console.log( "call resolve");
resolve( 0 );
}).then( (r)=>{ // この関数が実行されるのはイベントループを抜けた後
console.log( `here ${r}` );
l = r;
});
console.log( "=================" );
#include <stdlib.h>
#include <stdio.h>
int main(int argc,char* argv[])
{
int a = 0;
if( !!a = 1 ){ // !!a は、 aの二重反転の結果なので右辺値 このような代入は不可
/*
a.c(7): error C2106: '=': 左のオペランドが、左辺値になっていません。
*/
#include <iostream>
#include <cstdlib>
int main(int,char*[]){
int *a = malloc( sizeof(int) );
free(a);
*a = 1;
malloc( sizeof( int )); // ここ
return 0;
/**
GIT for Windows 用に作成した、 GIT_PAGER のプログラム
これはWindows のコンソール用のプログラムである。
背景
git のコンソール用のプログラムは、config 18n.logoutputencoding
cp932 でログの出力を決めることが出来る。しかしながら、Visual Studio
は i18n.logoutputencoding を考慮していないので、
i18n.logoutputencoding でエンコードされた内容をそのままutf-8 と理解
template<typename T> LRESULT
wndProc( HWND hWnd , UINT uMsg, WPARAM wParam ,LPARAM lParam )
{
if( WM_NCCREATE == uMsg ){
static SUBCLASSPROC const subClassProc =
[]( HWND hWnd, UINT uMsg , WPARAM wParam , LPARAM lParam , UINT_PTR uIdSubclass, DWORD_PTR dwRefData )->LRESULT{
if( dwRefData ){
if( WM_DESTROY == uMsg ){
LRESULT const result = reinterpret_cast<T*>( dwRefData )->wndProc( hWnd , uMsg , wParam , lParam );
RemoveWindowSubclass( hWnd , uIdSubclass , uIdSubclass );
#include <iostream>
#include <vector>
#include <type_traits>
class SomeType{
public:
SomeType()
{
std::cout << "Default Constructor" << std::endl;
}

headless google chrome でスクリーンショットを撮る

はじめに

サムネイル画像として、ブラウザのスクリーンショットを採用したい。 ブラウザのスクリーンショットを画像に保存するソフトウェアは多数あるが、 google chromeには、それをコマンドラインから行うためのオプションが存在する。 実際に使われているブラウザをレンダリングに使う事は有用なので今回は、スクリーンショット を撮影するプログラムとして google-chrome を採用したい。