Skip to content

Instantly share code, notes, and snippets.

@bisco
bisco / crowi_plugin_test.js
Last active July 6, 2016 21:45
crowiプラグインのサンプル
function get_data() {
source = document.getElementById("form-body").innerHTML.split("\n");
for(i in source) {
// データは改行を含まないとする
if(~source[i].indexOf("{")){
return JSON.parse(source[i]);
}
}
}
@bisco
bisco / signal_test.c
Created July 7, 2016 14:44
シグナルハンドラのテスト
#include <stdio.h>
#include <signal.h>
#include <sched.h>
int go_printf = 0;
void handler(int signum, siginfo_t* si_val, void* ctx) {
go_printf = 1;
}
@bisco
bisco / perf-script-sample.py
Created December 11, 2016 12:00
perf scriptでオレオレスクリプトを走らせるサンプル
# perf script event handlers, generated by perf script -g python
# Licensed under the terms of the GNU GPL License version 2
# The common_* event handler fields are the most useful fields common to
# all events. They don't necessarily correspond to the 'common_*' fields
# in the format files. Those fields not available as handler params can
# be retrieved using Python functions of the form common_*(context).
# See the perf-trace-python Documentation for the list of available functions.
import os
@bisco
bisco / Makefile
Last active May 17, 2017 14:28
C用Makefileのテンプレート
SRCDIR = $(realpath .)
INCDIR = $(SRCDIR)
OBJDIR = $(SRCDIR)
IGNORE = $(SRCDIR)/ignore_file.c
SRCS = $(filter-out $(IGNORE),$(wildcard $(SRCDIR)/*.c))
OBJS = $(subst $(SRCDIR),$(OBJDIR),$(SRCS:.c=.o))
EXE = a.out
CC = gcc
MAKE = make
@bisco
bisco / usb.stp
Last active May 21, 2017 15:48
systemtap test
#!/usr/bin/stap -gv
probe begin {
printf("force stop warning short TX\n")
}
probe end {
printf("stop probe\n")
}
@bisco
bisco / termbox-color.go
Created December 14, 2017 13:33
termbox-goの色見本を見るツール
package main
import (
"fmt"
"github.com/nsf/termbox-go"
"time"
)
func drawLine(x, y int, str string) {
color := termbox.ColorDefault
@bisco
bisco / gspread.py
Created December 20, 2017 12:50
Google Spreadsheet APIの薄いwrapper
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
SCOPES = 'https://www.googleapis.com/auth/spreadsheets'
CLIENT_SECRET_FILE = ''
@bisco
bisco / formatter.py
Last active August 24, 2018 04:25
perf formatter
#!/usr/bin/env python [31/1804]
#fileencoding: utf-8
from __future__ import print_function
import sys
MASK_32BIT = 0xFFFFFFFF
class BranchEntry:
def __init__(self, line):
@bisco
bisco / 1.json
Created December 8, 2018 13:58
zaimtoolの説明用json(1)
{
"CONSUMER_KEY" : "ここにConsumer Keyを入れる",
"CONSUMER_SECRET" : "ここにConsumer Secretを入れる",
"ACCESS_TOKEN" : "まだ空欄でよい",
"ACCESS_TOKEN_SECRET" : "まだ空欄でよい"
}
@bisco
bisco / 2.json
Created December 8, 2018 13:59
zaimtool説明用json(2)
{
"CONSUMER_KEY" : "ここにConsumer Keyを入れる",
"CONSUMER_SECRET" : "ここにConsumer Secretを入れる",
"ACCESS_TOKEN" : "さっきのoauth_token",
"ACCESS_TOKEN_SECRET" : "さっきのoauth_verifier"
}