Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 8.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :20141129
#usage :/bin/bash wildfly-install.sh
WILDFLY_VERSION=8.2.0.Final
WILDFLY_FILENAME=wildfly-$WILDFLY_VERSION
otoshidama <- function(x) {
rank <- c("一等?", "二等?", "三等!", "三等!", "外れ")
tosen <- c(97085, 2344, 72, 74)
result <- NULL
for (i in x) {
tmp <- grep(sprintf(".*%s$", i), tosen)
tmp <- ifelse(length(tmp) == 0, 5, tmp)
  result <- c(result, tmp)
}
cat("当選番号:", tosen, fill=TRUE)
library(ggplot2)
t1 <- as.table(Titanic[1:3,,2,2])
fortify.table <- function(model, ...) {
data <- reshape2::melt(model)
return(data)
}
p1 <- ggplot(data=t1)
(n <- 1.4 * 45)
#=> [1] 63
(n <- n %% 6)
#=> [1] 3
as.character(n)
#=> [1] "2.99999999999999"
as.integer(n)
#=> [1] 2
as.integer(round(n))
#=> [1] 3
@masaha03
masaha03 / TextImporter.R
Last active December 17, 2015 07:59
GUI for read.table
setRefClass("TextImporter",
fields = c("widget", "win", "filepath", "data"),
methods = list(
initialize = function(...) {
initFields(...)
data <<- NULL
if(class(win)[[1]] == "uninitializedField") {
win <<- NULL
}
encode.label <- gtkLabelNew(gettext("Character code"))
legend2 <- legend
body(legend2)[[49]] <- quote(
invisible(list(rect = list(w = w, h = h, left = left, top = top),
text = list(x = xt, y = yt), points = list(x = x1, y = y1)))
)
plot(-100:100, -100:100, type = "b")
myLegend <- legend2(1, .8, bty = 'n', c('sugar','citrus','none'), pch = 21,
pt.bg = 'white', pt.lwd = 0, lty = c(1, 2, 3), lwd = 1.5, title = "Condition",
@masaha03
masaha03 / gist:4396386
Created December 28, 2012 09:31
EXCELからSQLiteへの変換 xlsxのみ対応。読み込みたいセルの範囲に名前をつけておくのがポイント。 http://goo.gl/6R6Fo
library("XLConnect")
library("RSQLite")
table1 <- readNamedRegionFromFile("tables.xlsx", "table1")
driver <- dbDriver("SQLite")
conn <- dbConnect(driver, dbname = "foo.sqlite3")
dbWriteTable(conn, "table1", table1, row.names=FALSE)
dbDisconnect(conn)
@masaha03
masaha03 / gist:4325485
Created December 18, 2012 06:11
『心理学研究』に準拠したggplot2のtheme
theme_JPR <- function(base_size = 12, base_family = ""){
theme(
line = element_line(colour = "black", size = 0.5, linetype = "solid", lineend = "butt"),
rect = element_rect(fill = "white", colour = "black", size = 0.5, linetype = "solid"),
text = element_text(family = base_family, face = "plain", colour = "black", size = base_size, hjust = 0.5, vjust = 0.5, angle = 0, lineheight = 0.9),
axis.title.x = element_text(vjust = 0),
axis.title.y = element_text(vjust = 0, angle = 90),
axis.text = element_text(size = rel(1)),
axis.text.x = element_text(vjust = 1),
axis.text.y = element_text(hjust = 1),
@masaha03
masaha03 / server.R
Created November 10, 2012 03:18
Shiny server
library(shiny)
library(RFinanceYJ)
library(quantmod)
shinyServer(function(input, output) {
output$plot <- reactivePlot(function() {
data <- quoteStockXtsData(sprintf("%s.t", input$code),
since=input$since,
date.end=input$date.end,
@masaha03
masaha03 / ui.R
Created November 10, 2012 03:16
Shiny UI
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("株価"),
sidebarPanel(
numericInput("code", "code:", 6758),
textInput("since", "since:", as.character(Sys.Date()-60)),
textInput("date.end", "date.end:", as.character(Sys.Date())),