Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#!/usr/bin/env perl
use strict;
use warnings;
my $hexnum = shift || '0xdeadbeaf';
$hexnum =~ /0x([0-9a-fA-F]+)/ or die 'not hex number';
my $body = $1;
my $result = 0;
my $cnt = 0;
for (reverse split //, $body) {
#!/bin/sh
sid=`pgrep screen`
if [ `echo $sid | wc -l` = 1 ];then
cd /home/yaotti/tools/tiarra
screen -S $sid -p 0 -X exec /home/yaotti/tools/tiarra/tiarra --config=/home/yaotti/tools/tiarra/tiarra.conf
fi
(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 ("
@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/
#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.
!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
#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(...)
--- 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