This file contains 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
import cv2 | |
# https://github.com/nagadomi/lbpcascade_animeface/blob/master/lbpcascade_animeface.xml | |
cascade_path = './lbpcascade_animeface.xml' | |
def detect(image): | |
image_gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) | |
image_gray = cv2.equalizeHist(image_gray) | |
cascade = cv2.CascadeClassifier(cascade_path) | |
face_rect = cascade.detectMultiScale(image_gray, scaleFactor=1.1, minNeighbors=3, minSize=(50, 50)) |
This file contains 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
require 'selenium-webdriver' | |
require 'uri' | |
require 'open-uri' | |
require 'fileutils' | |
require 'digest/md5' | |
def write_urls(label, keyword) | |
driver = Selenium::WebDriver.for(:chrome) | |
driver.navigate.to('https://www.google.co.jp/imghp') | |
driver.find_element(:id, 'lst-ib').send_keys(keyword) |
This file contains 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
const quicksort = (array) => { | |
if (array.length <= 1) return array; | |
const pivot = array[Math.floor(Math.random() * array.length)]; | |
// 余計な走査は許してください。 | |
const left = array.filter(i => i < pivot); | |
const middle = array.filter(i => i === pivot); | |
const right = array.filter(i => i > pivot); |
This file contains 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 stack(current, result) | |
unless current.length < 4 | |
result << current | |
return | |
end | |
stack(current + 'a', result) | |
stack(current + 'b', result) | |
stack(current + 'c', result) | |
stack(current + 'd', result) |
This file contains 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
module Procedural | |
extend ActiveSupport::Concern | |
included do | |
private_class_method :new | |
end | |
class_methods do | |
def call(*args) | |
new(*args) |
This file contains 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
# ~/.config/fish/config.fish | |
## peco ## | |
function fish_user_key_bindings | |
bind \cr peco_select_history | |
end | |
## rbenv ## | |
set -x PATH $HOME/.rbenv/bin $PATH | |
rbenv init - | source |
This file contains 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
var page = require('webpage').create(); | |
var args = require('system').args; | |
page.viewportSize = { | |
width: 1200, | |
height: 780 | |
}; | |
page.open(args[1], function (status) { | |
if (status !== 'success') { |
This file contains 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
# enum 定義の後で include すること。 | |
module EnumValueGetter | |
extend ActiveSupport::Concern | |
included do | |
defined_enums.keys.each do |name| | |
define_method("#{name}_value") { self[name] } | |
end | |
end | |
end |
This file contains 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
ruby '2.3.0' | |
source 'https://rubygems.org' | |
gem 'rails', '~> 5.0.0.beta2' |
This file contains 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
const int LED4 = 13; | |
const int LED3 = 12; | |
const int LED2 = 11; | |
const int LED1 = 10; | |
const int BTN1 = 7; | |
int old_input = LOW; | |
int new_input = LOW; | |
int count = 0; | |