Skip to content

Instantly share code, notes, and snippets.

@yuryofujita
yuryofujita / file_grep.php
Last active June 12, 2019 04:44
php grepでファイルの文字列取得
<?php
echo "aaa";
echo PHP_EOL;
$cmd = 'find . -type f -name "*.txt" | xargs fgrep "Aki_Komo"';
$grep = exec($cmd);
$grep = preg_replace('/[^0-9]/', '', $grep);
echo $grep;
echo PHP_EOL;
?>
@yuryofujita
yuryofujita / make command
Last active April 27, 2019 05:35
Log when executing make command
[vagrant@localhost ~]$ cd vim/src
[vagrant@localhost src]$ make
Makefile:304: auto/config.mk: No such file or directory
rm -f auto/config.cache
if test "X" != "Xclean" \
-a "X" != "Xdistclean" \
-a "X" != "Xautoconf" \
-a "X" != "Xreconfig"; then \
GUI_INC_LOC="" GUI_LIB_LOC="" \
CC="" CPPFLAGS="" CFLAGS="" \
@yuryofujita
yuryofujita / EnglishNumerals.rb
Created June 3, 2012 13:46
English Numerals みなとRuby会議01
input = ARGV[0].to_i
underTwenty = %w(zero one two tree four five six seven eight nighn ten eleven tweleve thirteen fourteen fifteen sixteen seventeen eighteen nineteen)
overTwenty = %w(twenty thirty forty fifty sixty seventy eighty ninty)
hundred = "hundred"
thousand = "thousand"
if input <= 19 then
puts underTwenty[input]
end
@yuryofujita
yuryofujita / amida.rb
Created June 2, 2012 16:11
あみだくじ みなとRuby会議01
class Amida
def amida_def()
base1 = "| "
base2 = "|---"
base3 = ""
y="|"
records = Array.new(5,base1)
flg = 0
records.each do |elem|
x1 = rand(2)
@yuryofujita
yuryofujita / fizzbuzz.rb
Created June 2, 2012 13:30
Fizz Buzz問題
for i in 1..100
fizz = i % 3
buzz = i % 5
if fizz == 0 and buzz == 0 then
puts "fizzbuzz"
elsif fizz == 0 then
puts "fizz"
elsif buzz == 0 then
puts "buzz"