This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ echo hello,gpg > samle.txt | |
| $ cat sample.txt | |
| hello,gpg | |
| $ gpg --sign sample.txt | |
| gpg: no default secret key: secret key not available | |
| gpg: signing failed: secret key not available | |
| $ man gpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns google-reader.xml-test | |
| (:require [clojure.xml :as xml] | |
| [clojure.zip :as zip] | |
| [clojure.data.zip.xml :as dzx]) | |
| (:use clojure.test)) | |
| (def xml-str-1 | |
| (str "<root id='1'>" | |
| " <parent id='2'>" | |
| " <child id='3'/>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.bouzuya; | |
| import java.io.*; | |
| import javax.servlet.*; | |
| import javax.servlet.http.*; | |
| public class ServletExample extends HttpServlet { | |
| public void doGet(HttpServletRequest request, HttpServletResponse response) | |
| throws ServletException, IOException { | |
| String title = "ServletExample"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! s:insert_tmux_buffer() | |
| let buffers = split(system('tmux list-buffers'), '\n') | |
| if empty(buffers) | |
| return | |
| endif | |
| let buffers_origin1 = map(buffers, | |
| \ 'substitute(v:val, ''\V\^\d\+'', ''\=submatch(0) + 1'', '''')') | |
| call insert(buffers_origin1, 'tmux list-buffers', 0) | |
| let selected_index = inputlist(buffers_origin1) - 1 | |
| if selected_index >= 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (use 'clojure.test) | |
| (with-test | |
| (defn remove-x [x v] | |
| (vec (map #(set (remove #{x} %)) v))) | |
| (are | |
| [x v expected] | |
| (= (remove-x x v) expected) | |
| nil [] [] | |
| 2 [#{1 2 3}] [#{1 3}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package info.bouzuya.http_client; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; | |
| import org.apache.commons.httpclient.HttpClient; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (reduce (fn [m [k v]] (assoc m k v)) {} (doto (java.util.HashMap.) (.put "a" 1) (.put "b" 2))) | |
| ; => {"a" 1, "b" 2} | |
| (reduce-kv (fn [m k v] (assoc m k v)) {} (doto (java.util.HashMap.) (.put "a" 1) (.put "b" 2))) | |
| ; #<IllegalArgumentException java.lang.IllegalArgumentException: No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: java.util.HashMap> | |
| (into {} (doto (java.util.HashMap.) (.put "a" 1) (.put "b" 2))) | |
| ; => {"b" 2, "a" 1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package info.bouzuya.http_client; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; | |
| import org.apache.commons.httpclient.HttpClient; | |
| import org.apache.commons.httpclient.HttpMethodBase; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <property name="ivy.version" value="2.3.0" /> | |
| <property name="ivy.jar" value="ivy-${ivy.version}.jar" /> | |
| <available file="${ant.library.dir}/${ivy.jar}" property="ivy.installed" /> | |
| <target name="install-ivy" unless="ivy.installed"> | |
| <get dest="${ant.library.dir}" src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/${ivy.jar}" /> | |
| </target> | |
| <target name="retrieve" depends="install-ivy"> | |
| <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ant.library.dir}/${ivy.jar}" /> | |
| <ivy:retrieve /> | |
| </target> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package info.bouzuya.hateb; | |
| import java.io.IOException; | |
| import java.util.List; | |
| import org.jsoup.Jsoup; | |
| import org.jsoup.nodes.Document; | |
| import org.jsoup.nodes.Element; | |
| import org.jsoup.nodes.TextNode; | |
| import org.jsoup.select.Elements; |