Skip to content

Instantly share code, notes, and snippets.

// Copyright (C) 2006, deraw.
// Hatena Antenna Manual Update (Original):Copyright (C) 2005, hatena.
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name Hatena Antenna ManualMultiUpdate
// @namespace http://www.hatena.ne.jp
// @include http://a.hatena.ne.jp/*
// @description
@udaken
udaken / GetLinkTarget.cpp
Created August 29, 2017 03:47
LNKファイルからリンク先を取得するサンプルコード
HRESULT GetLinkTarget(IShellLinkWPtr pShellLink,const wstring &linkPath,wstring &target) throw()
{
HRESULT hr = S_OK;
{
IPersistFilePtr pPersistentFile;
hr = pShellLink.QueryInterface(IPersistFilePtr::GetIID(),&pPersistentFile);
if(SUCCEEDED(hr))
{
@udaken
udaken / GetUNCPath.cpp
Last active August 29, 2017 03:48
UNCパスを取得するサンプルコード
HRESULT GetUNCPath(LPCTSTR path,std::wstring &result)
{
using namespace std;
if(::PathIsNetworkPath(path) /*&& !::PathIsUNCServerShare(path) */)
{
TCHAR x[MAX_PATH] = {0};
lstrcpyn(x,path,MAX_PATH);
PathUnquoteSpaces(x);
@udaken
udaken / Archive.hpp
Created August 20, 2017 14:49
Header Only Wrapper Class for libarchive
#pragma once
#include "archive.h"
#include "archive_entry.h"
#include <mbstring.h>
#include <memory>
#include <exception>
#include <system_error>
#include <string>
namespace LibArchive
@udaken
udaken / twstring.hpp
Last active June 12, 2023 04:20
Tiny String class for Win32.(licensed under The Unlicense)
#pragma once
#include <windows.h>
#include <Shlwapi.h>
#include <Strsafe.h>
#pragma comment(lib, "Shlwapi.lib")
#include <utility>
#include <cassert>
#include <cwchar>
#include <cstdint>
// ==UserScript==
// @name Comic Claer HTML5 Player
// @namespace http://d.hatena.ne.jp/deraw
// @include http://www.comic-clear.jp/comic.aspx*
// @version 1
// @grant none
// @downloadURL https://gist.github.com/udaken/3ba84be372d6e71b88402dbc129c0346/raw/Comic_Clear_HTML5_Player.user.js
// ==/UserScript==
(function () {
@udaken
udaken / LibArchiveDecompressor.c
Created July 23, 2017 09:42
libarchiveでrarを読み取るためのサンプルソース(バージョン3.3.2時点では動作しない)
#ifdef _WIN32
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#define STRICT
#define STRICT_CONST
#include <windows.h>
#else
#include <sys/stat.h>
#include <unistd.h>
@echo off
@chcp 65001
:LOOP_BEGIN
if not "%~1" == "" (
pushd "%~d1%~p1"
echo "<%~n1%~x1>"
if /i "%~x1" equ ".zip" (
ren "%~n1%~x1" "%~n1.cbz"
@udaken
udaken / batch.kwd
Created June 14, 2017 03:57
Sakura Editor BAT/CMD keyword File
// MS-DOS batch キーワード定義ファイル
// CASE=False
@ECHO
AUX
BREAK
CALL
CD
CHCP
CHDIR
@udaken
udaken / diff_rule.txt
Created June 14, 2017 03:52
Sakura Editor diff/patch Rule
Index: /// index
--- /// ファイル名
+++ /// ファイル名
@@ /// 行番号
- /// 変更行
+ /// 変更行