Skip to content

Instantly share code, notes, and snippets.

View informationsea's full-sized avatar

Yasunobu Okamura informationsea

View GitHub Profile
@informationsea
informationsea / rename-pdf.py
Created May 2, 2012 05:52
Rename PDF by meta data
#!/usr/bin/env python2.7
import argparse
import pyPdf
import os
import os.path
def _main():
parser = argparse.ArgumentParser(description='rename PDF files')
parser.add_argument('pdf', nargs='+', type=argparse.FileType('rb'))
@informationsea
informationsea / growl.applescript
Created June 3, 2012 05:38
iChat notify with Growl
-- Put at "~/Library/Scripts/iChat"
on showgrowl(theNotify, theImage, theTitle, theMessage)
tell application "Growl"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Login", "Logout", "Present", "Text Message", "Invitation"}
-- Make a list of the notifications
@informationsea
informationsea / emacs-24.1-lion-fullscreen.patch
Created June 3, 2012 07:39
Emacs 24.1 Fullscreen patch for Lion
=== modified file 'lisp/term/ns-win.el'
--- lisp/term/ns-win.el 2012-02-25 10:04:30 +0000
+++ lisp/term/ns-win.el 2012-05-17 06:21:33 +0000
@@ -533,6 +533,12 @@
(interactive)
(ns-hide-others))
+(declare-function ns-fullscreen-toggle-cocoa "nsfns.m" ())
+
+(defun ns-fullscreen-toggle ()
@informationsea
informationsea / arrayrunner.py
Last active October 7, 2015 13:48
GridEngine Array Job Support Tool
#!/usr/bin/env python
import argparse
import os
import subprocess
import shlex
import sys
def _main():
"""
@informationsea
informationsea / gist:3192226
Created July 28, 2012 07:16
Density plot with grid
library(lattice)
gridensityplot <- function(...) {
densityplot(..., panel=function(...) {
panel.grid(h=-1, v=-1)
panel.densityplot(...)
})
}
@informationsea
informationsea / gist:3192275
Created July 28, 2012 07:39
Draw Heatmap with R
library(lattice)
library(gregmisc)
myxyplot <- function(x, y,
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)),
xlim,
ylim,
nbins=c(50, 50), alpha=0.05, func=function(x){x}, sub="", heat.map=T) {
c <- cor.test(x, y)
@informationsea
informationsea / transpose.py
Created August 30, 2012 11:20
Transpose Text Matrix
#!/usr/bin/env python
import argparse
import sys
import itertools
def _main():
parser = argparse.ArgumentParser(description='Transpose text array')
parser.add_argument('input', default=sys.stdin, nargs='?', type=argparse.FileType('r'))
parser.add_argument('output', default=sys.stdout, nargs='?', type=argparse.FileType('r'))
@informationsea
informationsea / gist:3747741
Created September 19, 2012 04:51
Draw bw-plot
library(lattice)
mybwplot <- function(x, y, interval=0.2, ylab=deparse(substitute(y)), xlab=deparse(substitute(x)), main="", sub="") {
bwplot(y ~ factor(trunc(x/interval)*interval), xlab=xlab, ylab=ylab, main=main, sub=sub,
panel=function(...){
panel.grid(h=-1, v=0)
panel.bwplot(...)
}, scales=list(rot=c(45,0)))
}
@informationsea
informationsea / growl.applescript
Created September 19, 2012 05:20
Message notify with growl on Mountain Lion
on showgrowl(theNotify, theImage, theTitle, theMessage)
tell application "Growl"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Login", "Logout", "Present", "Text Message", "Invitation"}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
@informationsea
informationsea / fixpermission.py
Created October 27, 2012 17:35
Fix permission by suffix of filename and prefix of file
#!/usr/bin/env python
import argparse
import os
import os.path
import stat
def _main():
parser = argparse.ArgumentParser(description='fix permission by suffix of filename and prefix of file')
parser.add_argument('dir', default='.', nargs='?', help='fix directory (default:%(default)s)')