windowsでgithubのrepositoryにpushするときにエラーがでる場合の対応

使用しているgitは以下。

$ git version
git version 2.6.3.windows.1

次のコマンドを実行すると、

git remote add origin https://hogehoge.gihttps://github.com/user_id/hogehoge.git
git push origin master

下記のエラーがでる。

!!!bash: /dev/tty: No such device or address!!!
!!!error: failed to execute prompt script (exit code 1)!!!
!!!fatal: could not read Username for 'https://github.com': Invalid argument!!!
!!!vimshell: exit 128 "git push origin master"!

上記はvimshellでのエラーだが、cmdから直接実行しても同様のエラーがでる。

対処法?

 1. 以下の方法によるが、試してない。 [Windows] bash: /dev/tty: No such a device or address · Issue #8984 · atom/atom · GitHub

以下のURLをremote repositoryのURLとして設定する。

https://<username>:<password>@github.com/<username>/<repo_name>.git

たとえば、次の場合、 * username:hoge * password:fuga * repo_name:hage

git remote add origin https://hoge:fuga@github.com/hage/hage.git

 2. こちらは、cmd上で動作は確認。vimshell上では未確認。

https://hoge@github.com/hage/hage.git

とするとパスワードが求められるので、入力する。

Googleの検索結果画面で使えるショートカット

Firefoxでは使えないようだが、chrome及びIEでは使える検索結果画面でのショートカット。

Google

googleのホームから適当にワードを検索する。

検索結果画面で以下のショートカットが使える。

キーボード 機能
J 次の検索結果を選択
K 次の検索結果を選択
O 選択した結果を表示
Enter 選択した結果を表示
/ 検索バーにフォーカス
Esc 検索バーのフォーカスをはずす

cppunitのテンプレ

cppunitでテストコードを書くときのテンプレ。

まずは、main.cpp。これはまるこぴでおっけ。

#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>


int main(int argc, char* argv[])
{
    // Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;

    // Add a listener that colllects test result
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener(&result);

    // Add a listener that print dots as test run.
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener(&progress);

    // Add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
    runner.run(controller);

    // Print test in a compiler compatible format.
    CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
    outputter.write();

    {
        int a = 0;
        std::cin >> a;
    }

    return result.wasSuccessful() ? 0 : 1;
}
    

テスト対象のクラスがNormalRandomGeneratorとする。

テスト用のクラスとしてNormalRandomGeneratorTest.h及びNormalRandomGeneratorTest.cppを用意する。

テストクラスのsetUp及びtearDownメソッドは各テストメソッド(ここではtestOperatorParenthesis)を実行する前と後に実行されるメソッド

NormalRandomGeneratorTest.h

#pragma once

//include test target hearder.
#include "cva/random/NormalRandomGenerator.h"

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestFixture.h>
namespace cva_test {
    class NormalRandomGeneratorTest : public CPPUNIT_NS::TestFixture {
        CPPUNIT_TEST_SUITE(NormalRandomGeneratorTest); //class name
        CPPUNIT_TEST(testOperatorParenthesis); //nane of test
        CPPUNIT_TEST_SUITE_END();

    private:
        void testOperatorParenthesis(); //test metdho declaration

        NormalRandomGenerator *_generator;
    };
}

NormalRandomGeneratorTest.cpp

#include "NormalRandomGeneratorTest.h"
namespace cva_test {
    CPPUNIT_TEST_SUITE_REGISTRATION(NormalRandomGeneratorTest);

    void NormalRandomGeneratorTest::setUp()
    {
        _generator = new NormalRandomGenerator();
    }

    void NormalRandomGeneratorTest::tearDown()
    {
        delete _generator;
    }

    void NormalRandomGeneratorTest::testOperatorParenthesis()
    {
        //test here
    }
}

参考

テスト駆動開発とかよくわからない人のための今すぐ使えるCppUnitテンプレ - EchizenBlog-Zwei

Visual Studio C++でCppUnitをビルドできない、そんなとき | skmks

windows7のセットアップ

インストールしたアプリ

ショートカットの設定

C:\ProgramData\Microsoft\Windows\Start Menu\Programsにjumpという名前でフォルダを作成。

フォルダ以下にショートカットを置くと、スターとメニューでショートカットが起動できる。

フォルダのショートカットの設定

C:\ProgramData\Microsoft\Windows\Start Menu\Programsにある適当なショートカットをコピーして、右クリック->プロパティを開く。

ショートカットのリンク先を以下のように設定。

C:\Windows\explorer.exe dir_path

dir_pathは、開きたいディレクトリのパス。

作業フォルダは適当に設定する。

thinkpad E450で削除したプリインストールアプリなど

削除したプリインストールアプリは以下。

参考

Lenovo ThinkPad のスタートアッププログラム・常駐プログラムについての詳細 - 情報科学屋さんを目指す人のメモ(FC2ブログ版)

  • SHAREit

    • dropboxみたいに何かシェアする
  • REACHit

    • dropboxなどのweb上のシステムに一括でアクセスできるようなもの
  • lenovo auto scroll utility

  • Message center plus

  • lenovo peer connect sdk

  • lenovo usb3.0 to dvi vba monitor adapter

    • usbでDVI/VGAモニターにつなぐアダプターのためのドライバ?
  • lenovo Quickcontrol

  • lenovo solution center

  • lenovo communications utility

  • thinkVantage active protection system(SSD換装後)

    • HDDを落下時の衝撃などから守る
  • マカフィー リブセーフ インターネットセキュリティ

PCの設定

  • タッチパッドの無効化

    • [コントロールパネル]->[マウス]->[ThinkPad]タブ->TouchPadの無効化

E450マニュアル等

製品仕様書

ThinkPad E450 製品仕様書 - 20DC005EJP,20DC005FJP,20DC005GJP,20DC005HJP | Lenovo | 日本

裏蓋の外し方、メモリの増設仕方などのマニュアル。 「ハードウェア保守マニュアル ThinkPad E450」で検索

ハードウェア保守マニュアル ThinkPad E450 - Google 検索

セットアップ手順

  1. リカバリメディアの作成

  2. SSDの換装とメモリの増設

  3. SSDとメモリのテスト

  4. windowsをリカバリメディアから復帰

リカバリメディアの作成

OS別手順

リカバリー方法 - Lenovo Support (JP)

Win7

リカバリー・メディアの作成方法 - Windows 7 - Lenovo Support (JP)

リカバリメディア用USB

Amazon CAPTCHA

SSDへの換装

E450用のマニュアル

ThinkPadのSSD換装~準備編 - Thinkpad E450の気になる話

ThinkPadのSSD換装~作業編 - Thinkpad E450の気になる話

ThinkPad E450のSSD換装手順はとっても簡単でした。

換装用SSD

Amazon CAPTCHA

Amazon.co.jp: Crucial [Micron製Crucialブランド] MX100シリーズ ( 512GB / 2.5インチ / SSD ) 国内正規品 CT512MX100SSD1: パソコン・周辺機器

メモリの増設

購入時は、DDR3L PC3L-12800 4GBの一枚差し、空きスロットは1。省電力用のDDR3L PC3Lなので注意。

ThinkPad E450 Review #2 裏蓋外し(JP) | Jibara de Review

増設用メモリ

価格.com - ADATA ADDS1600W4G11-R [SODIMM DDR3L PC3L-12800 4GB] 価格比較

リカバリメディアからの復帰

USBからbootする場合はBIOSでF12

ThinkPad E450のSSD換装手順はとっても簡単でした。

awkで偶数行目を取り出しと指定した数の倍数行に処理を追加

奇数行、偶数行を取り出す処理は、perlワンライナーであったり、sedだったり色々あるが、今回はawkでの処理を記載。

cat filename.txt | awk 'NR % 2 == 0 {print $0;}'

偶数行目のみを取り出して、5の倍数行に改行を2つ入れる処理は以下のようにする。

cat filename.txt | awk 'NR % 2 == 0 {print $0;}' | awk 'NR % 5 != 0 {print $0;} NR % 5 == 0{print $0;print "\n"}'