Skip to content

Instantly share code, notes, and snippets.

View daipresents's full-sized avatar

Dai Fujihara daipresents

View GitHub Profile
@daipresents
daipresents / gist:5754060
Created June 11, 2013 02:08
GithubのIssuesをバックアップするために、rspec + webdriver でIssueページのキャプチャをとりまくるスクリプトを作ってみた。webdriverの動かし方とかは http://buff.ly/14tt6KI などを参照のこと。
# coding:utf-8
require 'selenium-webdriver'
require 'rspec'
include RSpec::Expectations
describe "GithubのIssue保存" do
before(:each) do
@verification_errors = []
@driver = Selenium::WebDriver.for :chrome
@daipresents
daipresents / gist:5771783
Last active December 18, 2015 10:58
とあるBASIC認証がかかってるWevDAVサイトのPDFリンクを全部ダウンロードするシェル。 hrefがファイル名になっていた場合のサンプルなので、ダウンロードしたいファイルのURLの場合によっては修正が必要。
#!/bin/bash
export debug=false
export extension=pdf
export username=${Set a username}
export password=${Set a password}
export url=${PDF page url}
export output=/Users/yourname/Downloads
export number=3
1st: cURL file_get_contents
-----------------------------------------
1.0124351978302sec 1.0169038772583sec
0.90987610816956sec 1.0693500041962sec
0.89837217330933sec 1.0413548946381sec
0.90827202796936sec 0.99870181083679sec
0.91177892684937sec 1.1312601566315sec
0.84878087043762sec 1.0564041137695sec
0.88983201980591sec 1.0654909610748sec
0.81813597679138sec 1.0291340351105sec
@daipresents
daipresents / for-in-array.txt
Last active May 11, 2016 05:56
sample loop by bash
array=(
array01
array02
)
for entity in ${array[@]}; do
echo "${entity}"
done
# 実行結果
# SonarQubeを以下に解凍
C:\sonarqube
# SonarQube実行
C:\sonarqube\bin\windows-x86-64\StartSonar.bat
C:\Program Files (x86)\Jenkins\jobs\GetPageInfo\workspace>rspec C:\Selenium\get_page_info.rb
Started ChromeDriver
port=9515
version=22.0.1203.0b
log=C:\Program Files (x86)\Jenkins\jobs\GetPageInfo\workspace\chromedriver.log
[1029/122515:ERROR:proxy_launcher.cc(551)] Failed to wait for testing channel presence.
d:\src\chr0\src\chrome\test\automation\proxy_launcher.cc(478): error: Value of: automation_proxy_.get()
Actual: false
Expected: true</pre>
An error occurred in an after hook
pandoc -S --epub-metadata=metadata.xml -o sample.epub 01.md 02.md
# MarkdownからHTMLへの変換
pandoc -s Sample.md -o Sample.html
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'