This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdbool.h> | |
void print_bit_string(unsigned char n) { | |
for(int i=7; 0<=i; i--) { | |
printf("%d", (n >> i) & 1); | |
} | |
} | |
unsigned char slice_bit_string(unsigned char data[], int data_len, char slice_unit, int idx) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSData *recordedPcm; | |
AVAudioPlayer *player; | |
AudioQueueRef audioQueue; | |
AudioQueueBufferRef audioQueueBuffers; | |
// Queue/Buffer への追加は playPCM での1回しかしないため、コールバックでは何もしない (必要があればここで追加) | |
static void AQOutputCallback(void *userData, AudioQueueRef audioQueueRef, AudioQueueBufferRef audioQueueBufferRef) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* package whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
/* Name of the class has to be "Main" only if the class is public. */ | |
class Test | |
{ | |
public static void main (String[] args) throws java.lang.Exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Array | |
alias_method :top, :last | |
end | |
def eval_rpn(stack) | |
commands = { | |
"+": ->x, y { x + y }, | |
"-": ->x, y { x - y }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> // I2C用 | |
#include <ADXL345.h> // 加速度センサ用 | |
#include <TimerOne.h> //timer1 //timer0はdelay、timer2はtoneで使われてる(´・ω・`) | |
// #include "dtmtdatas.h" | |
#include "Helper.h" | |
// val の値を min と max の値に収まるようにする | |
// val < min :=> min | |
// min <= val <= max :=> val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'capybara' | |
# require 'capybara/poltergeist' | |
require "selenium-webdriver" | |
Capybara.current_driver = :selenium | |
url = "http://qrlogic.pwn.seccon.jp:10080/game/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logger | |
alias_method :add_old, :add | |
remove_method :add, :log | |
def method_missing(method_name, *args, &block) | |
if /^log|add$/ === method_name | |
puts "#{(args[1] && args[1] + ": ") || ""}#{args[2]}" | |
self.send(:add_old, *args, &block) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// StatusManager.h | |
// | |
// Created by kyontan on 2015/12/22. | |
// Licensed under CC0 | |
// | |
#import <Foundation/Foundation.h> | |
typedef NS_ENUM(NSInteger, Status) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_dim(f) | |
return 2 if f.include?(?2) | |
return 3 if f.include?(?3) | |
return 1 | |
end | |
def gravity(g) | |
return "west" if g == "l" | |
return "east" |