Skip to content

Instantly share code, notes, and snippets.

View earlgreyxxx's full-sized avatar

Kenji Nakagawa earlgreyxxx

  • Far West Kobe, Hyogo, Japan
  • 05:08 (UTC +09:00)
View GitHub Profile
" Set CMD 既定値に戻す
function! Fsetcmd()
set shell&
set shellcmdflag&
set shellslash&
set shellquote&
set shellxquote&
set shellxescape&
set grepprg&
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
table,th,td {
border-collapse: collapse;
border: 1px solid #aaa;
}
/*******************************************************************************
description:
ローカルのエクセルファイルを選択すると(<input type="file" id="select-file">、
選択したエクセルファイルへシートを追加し、テーブル要素(<table id="table-0">)を書込み、
そのエクセルシートをダウンロードするためのリンクをdocument.body に追加します。
※このままのコードだと、セルの書式属性は全部消えます。
*******************************************************************************/
(function($) {
/*******************************************************************************
Create screenshot for specified url. if success, output PNG binary data to STDOUT.
usage:
$ node screenshot.js URL [CSS SELECTOR] > screenshot.png
* if you want to get jpeg file ,use ImageMagick(convert) with pipe.
for example,
$ node screenshot.js URL | convert - screenshot.jpg
*******************************************************************************/
const WebDriver = require('selenium-webdriver');
$ node screenshot.js 'http://localhost/hogehoge/' | convert PNG:- -resize 600x screenshot.jpg
(node:14444) UnhandledPromiseRejectionWarning: Error: ESPIPE: invalid seek, write
at writeSync (fs.js:568:3)
at takeScreenshot.then (/mnt/c/Users/ddk5010/Desktop/temp/screenshot.js:75:39)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14444) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function witho
ut a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:14444) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will te
rminate the Node.js process with a non-zero exit code.
convert: improper image header `/tmp/magick-14445jzJc3SLocfrG' @ error/png.c/ReadPNGImage/3940.
/// <summary>
/// コンソール関連のヘルパー&ラッパー関数など。C#4.0必須
/// </summary>
public static class ConsoleEx
{
/// <summary>
/// メッセージを出力してキー入力を待機します。
/// </summary>
public static ConsoleKeyInfo WriteLineAndReadKey(string msg = "\n何かキーを押してください。",bool echoback = false)
{
/********************************************************
修正:2017/08/20 WebResponse.Headers.GetValuesメソッドから取得するように変更。
修正:2017/08/22 やっぱり forループよりLinq使った方がいいか・・・。
*********************************************************/
protected override WebResponse GetWebResponse(WebRequest request)
{
WebResponse response = base.GetWebResponse(request);
if(response is HttpWebResponse)
{
var httpWebResponse = response as HttpWebResponse;
/*
CommandLineToArgv()
エラーチェック・バッファチェックはしていない不完全版
ex.)
int argc = 0;
LPTSTR* argv = CommandLineToArgv(GetCommandLine(),&argc);
・・・
GlobalFree((HGLOBAL)argv);
*/
#define GLOBALALLOC(S) reinterpret_cast(GlobalAlloc(GPTR,(S)))
#define GLOBALFREE(X) {if(X){GlobalFree(reinterpret_cast(X));(X)=NULL;}}
#define HEAPALLOC(S) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(S))
#define HEAPFREE(X) {if(X){HeapFree(GetProcessHeap(),0,reinterpret_cast(X));(X)=NULL;}}
PSTR *CommandLineToArgvA(LPCSTR lpCmdLine,int *pNumArgs)
{
PSTR *pArgvA = NULL;
int Argc = 0;
#!/bin/sh
### capture image from movie file.
# defines default values
interval=60
bg=black
start=1
column=4
imagetype=png
vcodec=png