Skip to content

Instantly share code, notes, and snippets.

View shohey1226's full-sized avatar

Shohei Kameda shohey1226

View GitHub Profile
@shohey1226
shohey1226 / load-jquery-turbo.md
Last active June 2, 2022 22:32
How to load Jquery with Turbo

Googling Turbo is hard. Always google hits turbolinks. It needs to use -turbolink all the time. And less document comparing to turbolinks.

There is an event similar to turbolink to load JS.

import "@hotwired/turbo-rails"; 
import "controllers";
import jquery from "jquery";
@shohey1226
shohey1226 / create_g_suite_account.rb
Last active February 27, 2019 17:57
How to create GSuite user by ruby api (always confusing this due to a lack of docs..)
def create_g_suite_email
return if Rails.env.test? || Rails.env.development? # skip if it's test
g_email = "#{self.first_name}.#{self.last_name}@xxxx.com".downcase
user_object = Google::Apis::AdminDirectoryV1::User.new
user_object.primary_email = g_email
user_object.name = Google::Apis::AdminDirectoryV1::UserName.new
user_object.name.given_name = self.first_name
user_object.name.family_name = self.last_name
user_object.password = 'xxxxxxxxxxxx'
response = admin_directory.insert_user(user_object)
  • :winc (=Ctrl-w) e.g. :winc l
  • g+t/T (=tab move)
  • number+ g+t (=move the tab) e.g. 2 g t
  • :tabs (=show list of tabs)
  • Ctrl-e (set keymap to toggle tree view)
  • Ctrl-u Ctrl-p file search
  • Ctrl-u Ctrl-g pattern seach
  • :%y+ yank all contents in the file
@shohey1226
shohey1226 / adduser_github_sshpub_key.yml
Created March 1, 2014 02:23
Ansible playbook add user using public ssh key on Github
---
- name: add user and create ssh key
user: name=shohei
- name: dowanload pubkey from Github and placed as authorized_keys
get_url: url=https://github.com/shohey1226.keys dest=/tmp/shohei.authorized_keys
delegate_to: 127.0.0.1
- name: Create authorized_keys from the file that just downloaded
authorized_key: user=shohei key="{{ lookup('file', '/tmp/shohei.authorized_keys') }}"
#!/usr/bin/env bash
cmd=$1
container_name=$2
container_port=$3
host_port=$4
function usage() {
echo "Usage: $(basename ${0}) [add|list|delete] [container] [port] [host port]"
exit 1
}
Keyboard Command Description
Command + f Search a word
Command + c Copy
Command + v Paste
Command + r Reload *Try when Terminal is hung
Keyboard Command Description
Command + s Save file
Command + c Copy
Command + v Paste
Control + Tab Change file
Command + w Close file
Command + n Open new file
Keyboard Command Description
Command + i Show hints
Command + c Copy
Command + v Paste
Command + r Reload
Control + p Scroll up
Control + n Scroll down
Command + [ Go back
Command + ] Go forward
Keyboard Command Description
Command + Tab Move window
Command + Tab + Shift Move window - Reverse
Command + / Full screen(back from Full screen)
#!/bin/bash
if [[ ! -e $HOME/.plenv ]];then
git clone git://github.com/tokuhirom/plenv.git $HOME/.plenv
echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> $HOME/.bash_profile
echo 'eval "$(plenv init -)"' >> $HOME/.bash_profile
git clone git://github.com/tokuhirom/Perl-Build.git $HOME/.plenv/plugins/perl-build/
$HOME/.plenv/bin/plenv install 5.18.0
$HOME/.plenv/bin/plenv rehash
$HOME/.plenv/bin/plenv global 5.18.0