Skip to content

Instantly share code, notes, and snippets.

Avatar

KOBAYASHI Keiichi kobake

View GitHub Profile
@kobake
kobake / Program.cs
Last active Aug 2, 2020
https://twitter.com/jmitani/status/1289780665236430849 これのゴリ押し解き。「!!!! MIN mikanPrice = 45」っていうところが解。
View Program.cs
using System;
namespace Twitter340
{
class Program
{
static void Main(string[] args)
{
for (int mikanPrice = 1; mikanPrice <= 340; mikanPrice++)
{
@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
You can’t perform that action at this time.