Skip to content

Instantly share code, notes, and snippets.

@yoshimov
yoshimov / gist:9243285
Created February 27, 2014 02:40
Shell command to create patch file from org file.
find -name *.org | sed 's/\.org$//' | xargs -IF diff -c F.org F
@yoshimov
yoshimov / gist:9243169
Created February 27, 2014 02:31
Check the encoding of posix spawn standard out in ruby.
ruby -e 'require "posix-spawn"; process=POSIX::Spawn::Child.new("echo a"); o=process.out; puts o.encoding'
*** Get-WebFile.ps1.org 2013-12-11 13:59:13.174257200 +0900
--- Get-WebFile.ps1 2013-12-13 13:54:21.563447100 +0900
***************
*** 48,54 ****
Write-Debug "Setting the UserAgent to `'$userAgent`'"
$req.UserAgent = $userAgent
}
! $res = $req.GetResponse();
if($fileName -and !(Split-Path $fileName)) {
@yoshimov
yoshimov / hive.cmd
Created January 8, 2014 10:15
hive.cmd for hive 0.12.0 on windows.
@echo off
set HIVE_BIN_PATH=%~dp0
if "%HIVE_BIN_PATH:~-1%" == "\" (
set HIVE_BIN_PATH=%HIVE_BIN_PATH:~0,-1%
)
set HIVE_HOME=%HIVE_BIN_PATH%\..
set HIVE_LIB=%HIVE_HOME%\lib
set HADOOP_HOME=%HIVE_HOME%\..
set HADOOP=%HADOOP_HOME%\bin\hadoop.cmd
@yoshimov
yoshimov / checkNotify.js
Created January 7, 2014 11:24
GASで問い合わせ対応状況を1日に1回通知するスクリプト。
function checkNotification() {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getRange("G2");
var notify = false;
var str = "";
while (!cell.isBlank()) {
if (cell.getValue().toString() == "未") {
notify = true;
str += cell.offset(0, -6).getValue() + "番の問い合わせに未回答です。\n";
str += "担当は" + cell.offset(0, -1).getValue() + "さんです。\n";
;; Markdown memo
(defun markdown-memo-sendto-evernote ()
"Copy markdown file into evernote folder as text file."
(interactive)
(let* ((orgbuf (current-buffer))
(orgname (buffer-file-name))
(memonameorg (file-name-nondirectory orgname))
(memoname (concat (file-name-sans-extension memonameorg) ".txt"))
(destname (concat markdown-memo-evernote-dir memoname)))
@yoshimov
yoshimov / init.el
Last active December 29, 2015 01:59
initial script for Emacs 24.3
;;; -*- mode: lisp-interaction; syntax: elisp -*-
;;;
;;; Settings for Emacs
;;;
;(autoload 'add-path "path-util" t) ; Meadow 1.10 では使用不可
;(add-path "~/e-lisp") ;; Startup
;(setq shell-command-option "-c")
(setq load-path (cons "~/.emacs.d/elpa" load-path))
@yoshimov
yoshimov / Makefile
Last active December 27, 2015 18:19
Makefile for diagram files.
# Makefile for diagram files
#
# .dot
# Graphviz: http://www.graphviz.org/
#
# .sdiag .bdiag .adiag
# blockdiag: http://blockdiag.com/
.SUFFIXES: .png .dot .sdiag .bdiag .adiag
*** ./lib/grit/index.rb.org 2013-10-22 12:56:48.654590275 +0900
--- ./lib/grit/index.rb 2013-10-23 13:17:49.316559983 +0900
***************
*** 173,179 ****
k = obj.name
k += '/' if (obj.class == Grit::Tree)
tmode = obj.mode.to_i.to_s ## remove zero-padding
! tree_contents[k] = "%s %s\0%s" % [tmode, obj.name, sha]
end if now_tree
#!/usr/bin/perl
use lib './lib';
use strict;
use Wiki;
use Util;
use Jcode;
use HTML::Template;
my $wiki = Wiki->new('setup.dat');