Skip to content

Instantly share code, notes, and snippets.

View tenten0213's full-sized avatar
💭
😇

tenten0213 tenten0213

💭
😇
View GitHub Profile
@tenten0213
tenten0213 / jal.rb
Last active August 29, 2015 13:56
数字6桁パスワードのハッシュ値の総当たり
require 'digest/md5'
hash = "4b364677946ccf79f841114e73ccaf4f"
salt = "hoge$"
0.upto(999999) { |num|
pass = "%06d"%num
digest = Digest::MD5.new.update(salt + pass).to_s
if digest == hash
puts "Solved: #{pass}"
end
; via http://qiita.com/ka_/items/a3f79b761e25d485f2a9
; Clojure 超入門
; print
(println "Hello World!")
; 四則演算
(+ 1 2)
(* (+ 1 2) 3) ; (1 + 2) * 3
(* (+ 1 2) (- 3 4)) ; (1 + 2) * (3 - 4)
@tenten0213
tenten0213 / scrape_qiita.rb
Created March 13, 2014 08:57
qiitaの自分のストックをスクレイピング
require 'open-uri'
require 'nokogiri'
# proxy設定
proxy = "http://YOUR_PROXY:8080"
proxy_user = "PROXY_USER"
proxy_pass = "PROXY_PASS"
options = { proxy_http_basic_authentication: [proxy, proxy_user, proxy_pass] }
# スクレイピング先のURL
from urllib import request
from pyquery import PyQuery as pq
resp = request.urlopen("http://cookpad.com/recipe/1069312")
html = resp.read().decode("utf-8")
query = pq(html)
results = []
# レシピのメイン部を取得
from elasticsearch import Elasticsearch
es = Elasticsearch()
res = es.search(
index = 'ldgourmet',
doc_type = 'restaurants',
body= {
"query" : {
'simple_query_string': {
"query": "白金台 カフェ ボエム",
@tenten0213
tenten0213 / CostMatrixBuilder.java
Last active August 29, 2015 14:02
GoSenのビルド
/*
* Copyright (C) 2001-2007
* Taku Kudoh <taku-ku@is.aist-nara.ac.jp>
* Takashi Okamoto <tora@debian.org>
* Matt Francis <asbel@neosheffield.co.uk>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
@tenten0213
tenten0213 / DateUtil.java
Last active August 29, 2015 14:07
西暦和暦変換
package util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class DateUtil {
@tenten0213
tenten0213 / gen_bonjovi.rb
Last active August 29, 2015 14:09
ジョン・ボン・ジョヴィ 元ネタ: https://twitter.com/yagiyyyy/status/473405016540053504
def gen_bonjovi
bonjovi = %w(ボ ン ジョ ヴィ)]
random_jovis = []
count = 0
while(random_jovis.last(8).join != "ジョン・ボン・ジョヴィ") do
count += 1
random_jovis.push("・") if count % 2 == 0
random_jovis.push(bonjovi.sample)
end
puts random_jovis.join
@tenten0213
tenten0213 / Makefile
Last active August 29, 2015 14:13
Cygwinにtreeコマンド入れるためのMakefile
# $Copyright: $
# Copyright (c) 1996 - 2011 by Steve Baker
# All Rights reserved
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@tenten0213
tenten0213 / ChangeLocation.groovy
Created October 19, 2012 08:01
JenkinsでSVNのロケーションを切り替えるスクリプト。
class ChangeLocation{
static void main(args){
if (args.size()==2) {
println "config.xmlを読込み、SVNサーバーのロケーションを書き換えます。"
println "置換前:"+ args[0]
println "置換後:"+ args[1]
println "JOB完了後、Jenkinsの管理から設定の再読み込みを行なってください。"
new File("C:/Jenkins/jobs/").eachFile {
def target = it.toString()+"\\config.xml"