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
import os | |
import re | |
import sys | |
import time | |
from urllib.request import urlretrieve | |
channel = sys.argv[1] | |
with open(f'{channel}.txt', 'rt') as f: | |
lines = f.readlines() |
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
import os | |
import sys | |
import time | |
from selenium import webdriver | |
channel = sys.argv[1] | |
driver = webdriver.Chrome() | |
url = os.path.join('https://www.youtube.com/user', channel, 'videos') | |
driver.get(url) |
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
import os | |
import tensorflow as tf | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' | |
filename_queue = tf.train.string_input_producer( | |
tf.train.match_filenames_once('./images/ズワイガニ/*.jpg')) | |
reader = tf.WholeFileReader() | |
_, value = reader.read(filename_queue) |
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
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 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
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 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
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 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 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 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
module Procedural | |
extend ActiveSupport::Concern | |
included do | |
private_class_method :new | |
end | |
class_methods do | |
def call(*args) | |
new(*args) |
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
# ~/.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 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
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') { |