Skip to content

Instantly share code, notes, and snippets.

@RyosukeMiyahara
RyosukeMiyahara / checkExist.cpp
Created March 11, 2014 14:51
C++でファイルやフォルダが存在するかどうかを確認する
View checkExist.cpp
#include <iostream> // cout, endl
#include <sys/stat.h> // stat
int main(void) {
struct stat statFile;
struct stat statDirectory;
struct stat statNothing;
// if file/directory exists, stat() returns 0
// if file/directory does not exist, stat() returns -1
@hyuki0000
hyuki0000 / imeoff.rb
Last active April 19, 2016 04:30
自動的にIMEをオフにするスクリプト(実際に実行するのは10秒に一回)。
View imeoff.rb
#!/bin/ruby
# Based on http://blog.teapla.net/2015/05/5444
TOUCH_FILE = ENV["HOME"] + "/.imeoff"
INTERVAL_SEC = 10
if not File.exists?(TOUCH_FILE) or Time.now - File.ctime(TOUCH_FILE) > INTERVAL_SEC
system("osascript -e 'tell application \"System Events\" to key code 102'")
system("touch #{TOUCH_FILE}")
end
@pn11
pn11 / search_article.rb
Last active June 29, 2016 15:39
素粒子・宇宙系の雑誌名、号数、ページ数からURLを生成。Macのopenでブラウザに飛ばす。Moved to -> https://github.com/pn11/OkaScripts/tree/master/src/research#search_article
View search_article.rb
#!/usr/bin/ruby
if ARGV.size == 3
journal=ARGV[0]
volume=ARGV[1]
page=ARGV[2]
elsif ARGV.size == 2
journal=ARGV[0]
page=ARGV[1]
else
puts "Number of Argument is wrong. Use like this:"
@pn11
pn11 / Geant4_install.md
Last active June 1, 2019 00:33
Geant4.10.01をMac OS X Yosemiteにインストールしたメモ。
View Geant4_install.md

Geant4.10.01インストールメモ

今後Mac上でGeant4のversionを上げるときに見るためのメモ。今回の環境は

  • OS X Yosemite 10.10.2
  • Homebrew 使用

Geant4 10.1以降だとG4AnalysisManagerでNtupleにvectorを入れられるようなのでversionを上げてみた。 手順はインストールするたびにお世話になっている奥村さんの

@pn11
pn11 / markdown_spotlight.md
Last active June 1, 2019 10:14
SpotlightでMarkdownを検索できるようにする + クイックルックで見れるようにする
View markdown_spotlight.md
@pn11
pn11 / 1SaveMyClassIntoTTree.md
Last active June 1, 2019 10:20
ROOTで、自分つくったクラスをTTreeに入れるデモ
View 1SaveMyClassIntoTTree.md
@uasi
uasi / git-svn.markdown
Last active July 4, 2021 11:13
git-svn の使い方メモ
View git-svn.markdown

git-svn の使い方メモ

git-svn の使い方をメモする。他によいプラクティスがあれば指摘していただけるとありがたい。

用語

SVN のブランチと git のブランチが混在しているため、ここではブランチという語を以下のように区別する。

  • ブランチ、 SVN ブランチ:$SVN_REPO/branches 以下にあるディレクトリ
  • ローカルブランチ:git のローカルブランチ
  • リモートブランチ:git のリモートブランチ
@Loliver1224
Loliver1224 / C-j2Kana-powerpoint.json
Created December 5, 2021 04:32
Karabiner-Elements: Ctrl+j to Kana on PowerPoint for AquaSKK
View C-j2Kana-powerpoint.json
"rules": [
{
"description": "Ctrl-j to Kana on PowerPoint",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.microsoft\\.Powerpoint"
],
@mosmeh
mosmeh / how-to-use-giza-pp.md
Last active July 8, 2022 05:58
GIZA++ の使い方
View how-to-use-giza-pp.md

GIZA++ の使い方

GIZA++ は、統計的機械翻訳に使われるアライメントツールで、 IBM Model 1-5 と HMM を実装しています。今回は、Europarl Parallel Corpus で配布されている英独対訳コーパスのアライメントの尤度を推定させてみます。

セットアップ

# GIZA++ の準備
$ wget http://giza-pp.googlecode.com/files/giza-pp-v1.0.7.tar.gz
$ tar xfz giza-pp-v1.0.7.tar.gz

$ cd giza-pp

@gereon
gereon / gist:3150445
Created July 20, 2012 12:20
Mac OSX Spotlight Enhancement
View gist:3150445

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source