Skip to content

Instantly share code, notes, and snippets.

View comuttun's full-sized avatar

KOMATSU Seiji comuttun

  • Magmag, Inc.
  • Yokohama, Japan
View GitHub Profile
*.class
#include <stdio.h>
#include <stdlib.h>
#define COUNTER_RIGHT_BITS 24
#define COUNTER_MASK 0x000000ff
#define ADDER_RIGHT_BITS 16
#define ADDER_MASK 0x000000ff
#define SUM_MASK 0x0000ffff
#define extract_sum(v) (v & SUM_MASK)
@comuttun
comuttun / gist:2316871
Created April 6, 2012 04:31
Test Case Exaple
/**
* Test case, which uses multibyte (Japanese) characters
*/
public void testExecute_検証失敗_ログインID不正() throws Exception {
}
/**
* Test case, which uses only ascii characters (method name means as same as the above)
*/
public void testExecute_ValidationFailed_LoginIdIsWrong() throws Exception {
@comuttun
comuttun / gist:3649974
Created September 6, 2012 02:13
Tomcat startup check
start() {
if [ -f ${LOCKFILE} ]; then
echo "ERROR: LOCKFILE $LOCKFILE exists!" >&2
check_status
exit 1
fi
runuser romania -c "exec $TOMCAT_STARTUP $OPTIONS"
RETVAL=$?
@comuttun
comuttun / gist:3650098
Created September 6, 2012 02:25
Tomcat startup check (silent)
start_silent() {
echo "Starting $TOMCAT_NAME..."
if [ -f ${LOCKFILE} ]; then
echo "ERROR: LOCKFILE $LOCKFILE exists!" >&2
check_status
exit 1
fi
runuser romania -c "exec $TOMCAT_STARTUP $OPTIONS" >/dev/null 2>&1
@comuttun
comuttun / gist:3650348
Created September 6, 2012 02:57
Port check
#!/usr/bin/python
# vim: set fileencoding=ascii ts=2 expandtab :
import socket
import sys
class PortScanner:
def isOpened(self, ipaddr, port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM,0)
@comuttun
comuttun / gist:3652522
Created September 6, 2012 07:20
Startup checker
#!/bin/bash
. /etc/init.d/functions
LOGFILE=/tmp/tmp.log
KEYWORD=Started
CHECK_INTERVAL=5
TIMEOUT=30
TIME_COMMAND='date +%s'
@comuttun
comuttun / DelayedProgressDialog.java
Created October 1, 2012 09:13
Delayed Progress Dialog
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.app.ProgressDialog;
/**
* 一定時間後に表示する {@link ProgressDialog} です
* @author skomatsu
*
@comuttun
comuttun / teraterm-copy-to-clipboard-fix.patch
Created November 4, 2012 22:31
Tera Term Copying to Clipboard Problem Fix
Index: trunk/teraterm/teraterm/clipboar.c
===================================================================
--- trunk/teraterm/teraterm/clipboar.c (revision 5057)
+++ trunk/teraterm/teraterm/clipboar.c (working copy)
@@ -67,6 +67,10 @@
void CBClose()
{
BOOL Empty;
+ HGLOBAL CBCopyWideHandle = NULL;
+ LPWSTR CBCopyWidePtr = NULL;
@comuttun
comuttun / UpdatingRootCACerts.md
Created March 9, 2013 18:25
Updating root CA certs

Updating root CA certs

From Stackoverflow

Linux, Cygwin, etc

$ cd /usr/ssl/certs
$ curl http://curl.haxx.se/ca/cacert.pem | awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print &gt; "cert" n ".pem"}'