Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=320,user-scalable=no">
<style>
body {
margin: 0;
padding: 0;
height: 3000px;
@abicky
abicky / export.i.patch
Last active August 29, 2015 14:18
Files for CRFsuite
--- export.i.orig 2011-07-05 11:23:42.000000000 +0900
+++ export.i 2015-04-11 19:19:39.000000000 +0900
@@ -8,12 +8,13 @@
%include "std_vector.i"
%include "exception.i"
+%feature("director") Trainer;
+%include "crfsuite_api.hpp"
+
%template(Item) std::vector<CRFSuite::Attribute>;
@abicky
abicky / gist:1159958
Created August 21, 2011 01:32
Setting of shell on Emacs
(when (require 'multi-shell nil t)
(setq multi-shell-command "/bin/bash")
(setq multi-shell-buffer-name "bash")
(define-key shell-mode-map (kbd "C-c SPC") 'multi-shell-next)
(define-key shell-mode-map (kbd "C-c C-SPC") 'multi-shell-prev))
(defun bash()
(interactive)
(when (one-window-p)
(split-window-horizontally)
(other-window 1))
@abicky
abicky / check_pig_error.sh
Created October 3, 2011 18:51
print linenumber where error occurs in Pig
#!/bin/bash
usage() {
cat <<USAGE
usage: $(basename $0) [-p <param_name>=param_value] [-m <file_name>] [-x exectype] <script>
Execute the script with access to grunt environment.
-p <param_name - See parameter substitution for details.
-m <file_name> - See parameter substitution for details.
-x <exectype> - Set execution mode: local|mapreduce, default is mapreduce.
script - Script to be executed.
test.parseSpec <- function() {
checkEquals(c(hoge = "l"), parseSpec("hoge"))
checkEquals(c(hoge = "!"), parseSpec("hoge!"))
checkEquals(c(hoge = "+"), parseSpec("hoge+"))
checkEquals(c(hoge = "i"), parseSpec("hoge=i"))
checkException(parseSpec("hoge|fuga=s+"))
checkEquals(c(hoge = "s@", fuga = "s@"), parseSpec("hoge|fuga=s@"))
}
test.checkType <- function() {
parseSpec <- function(spec) {
vars <- strsplit(spec, "\\|")[[1]]
if (any(grepl("\\s", vars))) {
stop()
}
#lastvar <- sub("([^=:]+)([=:])?", "\\1 \\2 ", vars[length(vars)])
lastvar <- sub("([^=:]+)(=)?", "\\1 \\2 ", vars[length(vars)])
lastvar.elems <- strsplit(lastvar, " ")[[1]]
strlen <- nchar(lastvar.elems[1])
if (substring(lastvar.elems[1], strlen) %in% c("!", "+")) {
-brief
-cat
-chgrp
-chmod
-chown
-copyFromLocal
-copyToLocal
-count
-cp
-dot
@abicky
abicky / ROAuth.patch
Created November 19, 2011 14:23
patch for ROAuth package
diff -cr ROAuth.orig/R/ROauth.R ROAuth/R/ROauth.R
*** ROAuth.orig/R/ROauth.R 2011-06-03 13:10:28.000000000 +0900
--- ROAuth/R/ROauth.R 2011-11-19 19:13:36.000000000 +0900
***************
*** 128,146 ****
auth <- signRequest(url, params, consumerKey, consumerSecret,
oauthKey=oauthKey, oauthSecret=oauthSecret,
httpMethod="POST", signMethod=signMethod)
opts <- list(...)
@abicky
abicky / twitteR.patch
Created November 19, 2011 14:23
patch for twitteR package
diff -cr twitteR.orig/R/base.R twitteR/R/base.R
*** twitteR.orig/R/base.R 2011-11-09 07:15:21.000000000 +0900
--- twitteR/R/base.R 2011-11-19 23:29:19.000000000 +0900
***************
*** 1,7 ****
setRefClass('twitterObj',
contains='VIRTUAL',
methods = list(
! toDataFrame = function(row.names=NULL, optional=FALSE) {
fields <- names(.self$getRefClass()$fields())
@abicky
abicky / RJSONIO_0.96-0.patch
Created January 3, 2012 19:09
patch for RJSONIO_0.96-0
diff -cr RJSONIO.orig/src/libjson/JSONOptions.h RJSONIO/src/libjson/JSONOptions.h
*** RJSONIO.orig/src/libjson/JSONOptions.h 2011-10-23 02:00:32.000000000 +0900
--- RJSONIO/src/libjson/JSONOptions.h 2012-01-05 01:54:00.000000000 +0900
***************
*** 79,85 ****
* means that libjson supports the full array of unicode characters, but also takes
* much more memory and processing power.
*/
! //#define JSON_UNICODE