View update-allenv.py
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
#!/usr/bin/env python | |
import os | |
import subprocess | |
HOMEDIR = os.getenv('HOME') | |
GIT_COMMAND = 'git pull --rebase origin master' | |
git_clone_dirs = ['.rbenv', '.rbenv/plugins/ruby-build', '.pyenv'] | |
brew_commands = ['perlbrew self-upgrade', 'perlbrew -f install-cpanm', 'nodebrew selfupdate'] |
View rpn.rb
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 'set' | |
class RPN | |
def initialize(exp) | |
@exp = exp.split(/\s+/) | |
@stack = [] | |
@operators = Set['+', '-', '*', '/', '%'].freeze | |
end | |
def eval |
View priorityqueue.rb
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
# Priority Queueの練習 | |
# | |
# 参考 | |
# - https://ufcpp.net/study/algorithm/col_heap.html | |
class PriorityQueue | |
attr_reader :data, :test_function | |
def initialize(test_function = ->(a, b) { a <=> b }) | |
@data = [] |
View heapsort.rb
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
# ヒープソートの練習 | |
# | |
# 参考 | |
# - https://ufcpp.net/study/algorithm/col_heap.html | |
# - https://ufcpp.net/study/algorithm/sort_heap.html | |
def make_heap(array, last_index) | |
while (last_index > 0) | |
parent = ((last_index - 1) / 2).floor | |
break unless (array[last_index] > array[parent]) |
View Get_Started_with_Eager_Execution.py
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
# https://www.tensorflow.org/get_started/eager | |
# Configure imports and eager execution | |
from __future__ import absolute_import, division, print_function | |
import os | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
import tensorflow.contrib.eager as tfe |
View watson-speech-to-text.rb
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 'uri' | |
require 'net/http' | |
username = "<YOUR API KEY>" | |
password = "<PASSWORD>" | |
file = 'TEST.wav' | |
response = nil | |
url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=ja-JP_BroadbandModel' |
View LinkedList.c
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
// -*- mode: c; coding: utf-8 -*- | |
/* | |
* リンクリストの練習 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* | |
* リストの要素型 |
View send-message.ps1
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
################################################################################ | |
# E-mail tool in PowerShell | |
# | |
# 0. Set execution policy to "RemoteSighed" in PowerShell | |
# Set-ExecutionPolicy RemoteSigned | |
# | |
# 1. Right click this file and select "Run with PowerShell" from context menus. | |
# Or run the following command in cmd.exe. | |
# powershell -Sta -File send-message.ps1 | |
# |
View insert_sql_generator.rb
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
# | |
# INSERT query generator for Oracle | |
# | |
# Requirements: | |
# - Ruby 2.0 or later (https://www.ruby-lang.org/) | |
# - ruby-oci8 (gem install ruby-oci8) | |
# - Oracle Database | |
# | |
require 'oci8' |
View prime-factorization-test.lisp
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
;; -*- mode: lisp; coding: utf-8 -*- | |
;; -------------------------------------------------------------------------------- | |
;; 問題: | |
;; 210 = 2×3×5×7 | |
;; 整数を素因数分解したとき、上のような、元の数の「各桁の和」と | |
;; 素因数分解した「×の個数」が等しくなる整数を求めるプログラムを | |
;; 書いてください | |
;; https://codeiq.jp/ace/joboffer_apli/q1237?dspn=RHuDm3lalVgWKiDtlJz7oTn0beWgAuPxV4vDWcWiBCBKvMnuVBMQcJTdHL8vKXSh | |
;; -------------------------------------------------------------------------------- |
NewerOlder