Skip to content

Instantly share code, notes, and snippets.

tyamaguchi tkfm-yamaguchi

Block or report user

Report or block tkfm-yamaguchi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tkfm-yamaguchi / my-combination.rb
Last active Dec 3, 2019
RIoW for Array#combination, but it is a single method.
View my-combination.rb
require "test/unit"
def combination(a, k)
return{|n| [n] } if k == 1
a[0..(a.size - k)].each_with_index.reduce([]) do |c, (n, i)|
c + combination(a[i.succ..-1], k - 1).map{|r| [n, *r]}
tkfm-yamaguchi / MyController.php
Last active Nov 26, 2019
the simplest form of Symfony controller
View MyController.php
namespace AppBundle\Controller;
use Exception;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
tkfm-yamaguchi /
Last active Feb 18, 2019
duplicated homebrew formulae

Errors while executing brew update

fatal: could not read Username for '': terminal prompts disabled
fatal: could not read Username for '': terminal prompts disabled
fatal: could not read Username for '': terminal prompts disabled
fatal: could not read Username for '': terminal prompts disabled
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-boneyard failed!
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-completions failed!
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-fuse failed!

Needs To Fix

  • vim-jsx-typescript
    • syntax/indent: would be broken when {} to execute JS/TS
    • syntax/indent: would be broken when no value attribute is specified
tkfm-yamaguchi / open_dir_with_vaffle.vim
Last active Feb 5, 2019
Open dir with vaffle when dir is specified while starting vim
View open_dir_with_vaffle.vim
" Open vaffle when the first buffer is a directory
" (the directory name is specified as a argument in terminal)
function! s:open_dir_with_vaffle()
let l:bufName = bufname('%')
if (isdirectory(l:bufName))
execute "Vaffle " . l:bufName
tkfm-yamaguchi / index.html
Last active Jan 23, 2019
OwlCarousel's bug when {loop: false, autoWidth: true} (reproduction & workaround)
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Workaround for OwlCarousel's autoWidth:true/loop:false bug</title>
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
/* common style */
.carousel-item {
tkfm-yamaguchi / run_terms.vim
Created Jan 22, 2019
Create tab for terminals within js project
View run_terms.vim
function! RunTerms()
terminal ++close ++curwin yarn start
terminal ++close yarn test
" use `term_start` to set 'cwd' option
vertical call term_start('http-server -p 8000 --cors', {'cwd': 'data', 'term_finish': 'close'})
tkfm-yamaguchi / flatten_with_loop.rb
Last active Dec 28, 2018
flatten with loop (no recursion)
View flatten_with_loop.rb
class Array
# flatten without recursion but loop
def myflatten!
i = 0
while i < self.size
unless self[i].is_a?(Array)
i += 1
sudo grep -i -a -B 100 -A 100 'string' /dev/sda1 > file.txt
# or
# sudo grep -F -a -C 100 'string' /dev/sda1 > file.txt
# ref:
tkfm-yamaguchi /
Created Dec 12, 2018
Can't upgrade/purge redis server on Debian/Ubuntu (apt adapting distros)


  • Upgrading redis-server is failed with apt upgrade.
  • apt purge redis-server is failed

The reason for the failure of both apt command above is something is timeout.

Solution (one of)

You can’t perform that action at this time.