Skip to content

Instantly share code, notes, and snippets.

@tsuchm
tsuchm / cabocha-client.pl
Created November 28, 2018 04:40
Server and Client of CaboCha
#!/usr/bin/perl
# 指定された文を cabocha-server.pl を使って構文解析する
# libwww-perl <URL: http://search.cpan.org/~gaas/libwww-perl/> のイン
# ストールが必要.
use Getopt::Long;
use LWP::UserAgent;
use strict;
#!/usr/bin/python3
# When # of process is equal to 1:
# real 13m6.743s
# user 0m8.840s
# sys 0m0.308s
# When # of processes is equal to 2:
# real 6m33.596s
# user 0m9.284s
#!/usr/bin/python3
import pyknp
import re
# singleton pattern
class KNP:
_instance = None
_knp = None
def __new__(cls):
#!/bin/sh
# Usage: Put this script under /etc/cron.daily/.
set -e
PATH=/bin:/usr/bin:/usr/sbin:/sbin
src_vol=/dev/vg1/lv1
snap_vol=${src_vol}_snap
#!/bin/bash
# The recent Windows 7 checks the model version of the CPU, and complains that Windows Update
# is unavailable when the modern CPU is installed.
# In order to avoid this problem, the method to change the CPU ID which is described at
# https://superuser.com/questions/625648/virtualbox-how-to-force-a-specific-cpu-to-the-guest
# is insufficient based on my experience.
# In order to avoid this problem, the method to specify the CPU profile which is described at
@tsuchm
tsuchm / git-lfs.yml
Last active June 17, 2019 21:31
Ansible playbook to install Git-LFS debian package
# For more detail, see https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh
# Because Git-LFS repository use HTTPS, apt-transport-https package is necessary.
- name: Install apt-transport-https
apt: name=apt-transport-https state=present
- name: Add Git-LFS repository key
apt_key:
url: https://packagecloud.io/github/git-lfs/gpgkey
state: present
@tsuchm
tsuchm / intel-mkl.yml
Last active August 12, 2019 07:59
Ansible playbook to install Intel MKL debian package (for Buster)
- name: Add Intel-MKL packages
apt:
name: intel-mkl
state: latest
- name: Install python3-pip
apt:
name: ['python3-pip',
'python3-setuptools',
'python3-numpy',
@tsuchm
tsuchm / apt_preferences
Last active April 7, 2021 16:22
Ansible Playbook to install nvidia-docker2
Package: libnccl-dev
Pin: version *cuda9.1
Pin-Priority: 999
Package: libnccl-dev
Pin: version *cuda9.0
Pin-Priority: 999
Package: libnccl2
Pin: version *cuda9.1
@tsuchm
tsuchm / pdfunup.sh
Last active May 23, 2018 12:46
Script which converts the 2-up PDF file into the single page PDF file
#!/bin/sh
usage(){
cat <<EOF
This script converts the 2-up PDF file into the single page PDF file.
For example, http://www.city.yokohama.lg.jp/kankyo/midoriup/jigyo/mori/guidebook.pdf
is a PDF file which consists of A3 16 pages, each A3 page contains 2
A4 pages. In order to print the above PDF as a brochure, do the
following procedure.
@tsuchm
tsuchm / remote-sudo.sh
Created May 2, 2018 23:25
Run sudo on remote machines
#!/bin/bash
usage(){
cat <<EOF
Usage: remote-sudo host0 host1 ... hostN -- command arg0 arg1 ... argN
EOF
}
ALLHOSTS=(node0 node1 node2 node3 node4 node5 node6 node7 node8 node9)
DOMAIN=example.jp