Skip to content

Instantly share code, notes, and snippets.

@miyakawataku
miyakawataku / opennlpnote.rst
Last active January 25, 2021 09:13
OpenNLPの固有表現抽出器に関する調査
termcapinfo xterm* 'Co#256:pa#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm:'
termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
attrcolor b ".I"
defbce "on"
@miyakawataku
miyakawataku / gist:7540259
Created November 19, 2013 04:18
Launch a VirtualBox VM in the headless mode.
CreateObject("WScript.Shell").Run """C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe"" -s uqbar",0
@miyakawataku
miyakawataku / google-issues-to-bitbucket.rb
Created May 28, 2013 16:52
Extracts issues of a project on Google Code, and transforms them to BitBucket issues package.
#!/usr/bin/env ruby
# vim: et sw=2 sts=2
require 'rexml/document'
require 'open-uri'
require 'nokogiri'
require 'json'
class Issue
def initialize(entry)
@miyakawataku
miyakawataku / gist:5425774
Last active December 16, 2015 11:09
Cleans up Jenkins EC2 slaves which have failed to launch. Use this script as a system groovy script with Groovy Plugin.
import jenkins.model.Jenkins
import hudson.slaves.OfflineCause
for (node in Jenkins.instance.getNodes()) {
computer = node.toComputer()
if (computer.getOfflineCause() instanceof OfflineCause.LaunchFailed) {
node.terminate()
}
}
@miyakawataku
miyakawataku / gist:5381972
Created April 14, 2013 08:42
find & grep from Vim commandline
command! -nargs=1 Grep call s:Grep(<f-args>)
function! s:Grep(command)
let orig_grepprg = &l:grepprg
let &l:grepprg = substitute(a:command, '|', '\\|', 'g')
grep
let &l:grepprg = orig_grepprg
endfunction
@miyakawataku
miyakawataku / omron-ups.service
Created March 17, 2013 00:21
Systemd .service file for auto shutdown service (SimpleShutdown) of Omron UPS. Deploy the file into /etc/systemd/system and execute following commands. # systemctl enable omron-ups.service # systemctl start omron-ups
[Unit]
Description=Auto Shutdown Service (SimpleShutdown) for Omron UPS
[Service]
Type=forking
ExecStart=/usr/lib/ssd/master/ssdService
KillSignal=SIGUSR1
Restart=on-abort
RestartSec=4
@miyakawataku
miyakawataku / overwrite_dir_link.sh
Last active December 14, 2015 17:28
Overwrite a symbolic link of a directory.
@miyakawataku
miyakawataku / gist:3892472
Created October 15, 2012 13:30
Transform a field of a data frame
transform(emp, nation2 = ifelse(nation == 'England', 'Eng', as.character(nation)))
@miyakawataku
miyakawataku / Sort.java
Created July 28, 2012 07:21
Sort an array of integers using an anonymous class or a lambda
import java.util.Arrays;
import java.util.Comparator;
public class Sort {
public static void main(String[] args) {
// [0, 1000) の整数列
Integer[] numbers = new Integer[10];
for (int index = 0; index < numbers.length; ++ index)
numbers[index] = (int) (Math.random() * 1000);