Skip to content

Instantly share code, notes, and snippets.

KOBAYASHI Keiichi kobake

Block or report user

Report or block kobake

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kobake
kobake / PointerSize.cpp
Last active Nov 5, 2018
Class method pointer size
View PointerSize.cpp
#include <stdio.h>
#include <iostream>
#include <string>
class A {
public:
A(const char* str) { m_str = str; }
virtual ~A() {}
virtual void Foo(int n, int m) {
printf("A %d %d %hs\n", n, m, m_str.c_str());
View template-sample-int.cpp
#include <stdio.h>
#include <string.h>
// For specify int
template <int N>
class Buffer {
public:
Buffer() {
m_buf[0] = 0;
}
View template-sample-inheritance.cpp
#include <stdio.h>
#include <vector>
class IDumpable {
public:
virtual void Dump() = 0;
};
// For inheritance
template <class T>
View template-sample-generics.cpp
#include <stdio.h>
// As generics
template <class T>
class List {
public:
List() {
m_count = 0;
}
void Add(const T& t) {
@kobake
kobake / git-commit-size.sh
Created Nov 5, 2017
Calculate size of a git commit object.
View git-commit-size.sh
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: git-commit-size.sh <commit hash>" 1>&2
exit 1
fi
HASH=$1
ITEM_LIST="`git diff-tree -r -c -M -C --no-commit-id $HASH`"
View chrome-developer-console.js
var s = "";
for(var i = 1; i <= 255; i++){
var c = String.fromCharCode(i);
s += c;
if(c == '@')s += '​'
}
$('#tweet-box-home-timeline').html(
"<div>255chars</div>"
+ "<div>" + s + "</div>"
+ "<div>#280characters</div>");
@kobake
kobake / github-markdown-toc.js
Created May 10, 2017
GitHub の Markdown に TOC (目次) を付けるブックマークレット(旧jQuery版。2017年5月現在以降はこのスクリプトは機能しなくなりました)
View github-markdown-toc.js
// style
var style = (function () {/*
.toc{
border: 1px solid #aaa;
padding: 4px 12px;
margin-bottom: 12px;
position: relative;
padding-top: 30px;
}
.toc-title{
@kobake
kobake / freee-auto-timecard.js
Created Mar 13, 2017
給与計算フリー:勤怠自動入力スクリプト
View freee-auto-timecard.js
setInterval(function(){
if($('.spinner').length == 0 && $('.work-record-edit-balloon .submit-button').length > 0){
console.log("click");
$('.work-record-edit-balloon .submit-button')[0].click();
}
else{
console.log("wait");
}
}, 500);
@kobake
kobake / bitcoin-build-performance-with-ccache.sh
Last active Mar 7, 2017
ccache 有無による bitcoin ビルド時間の変化の計測
View bitcoin-build-performance-with-ccache.sh
#!/bin/bash
#
# Ref article: http://blog.clock-up.jp/entry/2017/03/07/ccache
#
# system information
uname -a
cat /etc/system-release
cat /proc/cpuinfo
@kobake
kobake / db-4.8.30-fix-for-mingw.patch
Created Feb 4, 2017
Berkeley DB 4.8.30 fixing patch for building on MinGW
View db-4.8.30-fix-for-mingw.patch
diff --git a/dbreg/dbreg.c b/dbreg/dbreg.c
index 5876ce4..46473dc 100644
--- a/dbreg/dbreg.c
+++ b/dbreg/dbreg.c
@@ -680,6 +680,8 @@ __dbreg_failchk(env)
LOG *lp;
int ret, t_ret;
char buf[DB_THREADID_STRLEN];
+ db_threadid_t unused;
+ memset(&unused, 0, sizeof(unused));
You can’t perform that action at this time.