Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
@yaotti
yaotti / anything-mac-itunes.el
Created December 2, 2010 13:17
Anything interface for iTunes (Mac only)
;;; anything-mac-itunes.el --- Use iTunes on Mac with anything.el
;; Copyright (C) 2010 Hiroshige Umino
;; Author: Hiroshige Umino <[email protected]>
;; Created: 2010-11-24
;; Version: 0.0.1
;;
;; Keywords: anything, mac
;;
tell application "iTunes"
set allSongs to (every file track of playlist "Library")
set idx to random number from 0 to (count of allSongs) - 1
set aSong to item idx of allSongs
play aSong
end tell
#!/bin/sh
# append the line "BRANCHNAME: " to the top of commit msg
if [ "$2$3" = "" ]; then
branch=$(git symbolic-ref HEAD 2>/dev/null)
branch=${branch##refs/heads/}
echo "$branch: \n`cat $1`" > "$1"
fi
--- nanotap.h 2010-11-18 23:51:59.000000000 +0900
+++ nanotap+color.h 2010-11-18 23:54:57.000000000 +0900
@@ -18,6 +18,7 @@
#endif
static int TEST_COUNT = 0;
+static int FAIL_COUNT = 0;
/**
* This simply evaluates any expression ("$got eq $expected" is just a
#ifndef DEBUG_H
#define DEBUG_H
#if DEBUG
#define ILOG(...) fprintf(stderr, "\e[32m[I]\e[0m " __VA_ARGS__)
#define DLOG(...) fprintf(stderr, "\e[33m[D]\e[0m " __VA_ARGS__)
#define ELOG(...) fprintf(stderr, "\e[31m[E]\e[0m " __VA_ARGS__)
#define LINE fprintf(stderr, "\e[31m------------------------------\e[0m")
#else
#define ILOG(...)
!setting to make Hennkann/Muhennkann keys to be ctrl keys
clear mod3
keycode 100 = Control_R
add control = Control_R
keycode 102 = Control_L
add control = Control_L
#include <string>
#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#define LINE std::cout << "------------------------------------------------------------" << std::endl;
// $ ./logging_sample -logtostderr=1
int main(int argc, char* argv[]) {
// Initialize Google's logging library.
@yaotti
yaotti / update-chromium-mac
Created July 29, 2010 11:53
download and install the latest chromium for mac
#!/bin/sh
rooturl="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/"
zipfile="chrome-mac.zip"
cd ~/tmp
rm -rf chrome-mac*
wget $rooturl`curl ${rooturl}LATEST`"/"$zipfile
unzip $zipfile
cd ./chrome-mac
cp -R ./Chromium.app /Applications/
(defun insert-str-with-line-context (regexp inserting-str default-char)
(let ((ptr (point)))
(beginning-of-line)
(let ((str (buffer-substring (point) ptr)))
(goto-char ptr)
(if (string-match regexp str)
(insert inserting-str)
(insert default-char)))))
;; typing "4" inserts "$", not "4" if you wrote "my " or "my ("