Skip to content

Instantly share code, notes, and snippets.

View jumbosushi's full-sized avatar

Atsushi Yamamoto jumbosushi

View GitHub Profile
@jumbosushi
jumbosushi / hiragana.rb
Last active June 28, 2020 20:31
Convert kanji to hiragana via Goo API
View hiragana.rb
require 'faraday'
require 'faraday-rate_limiter'
require 'openssl'
require 'pry'
require 'json'
# To avoid Faraday's OpenSSL error
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
kanji_1 = "ジャズシャンソン歌手
@jumbosushi
jumbosushi / clone_vim.sh
Last active June 26, 2019 00:51
Clone bare vim docker setup
View clone_vim.sh
git clone https://github.com/jumbosushi/dotfiles.git ~/.vimsetup
cp ~/.vimsetup/.vimrc_bare ~/.vimrc
cp ~/.vimsetup/.editrc ~/.editrc
cp ~/.vimsetup/.inputrc ~/.inputrc
cp ~/.vimsetup/.pryrc ~/.pryrc
cp ~/.vimsetup/.tmux.conf ~/.tmux.conf
@jumbosushi
jumbosushi / autopass.sh
Last active January 21, 2019 06:26
Automate UBC CS server git auth
View autopass.sh
#!/usr/bin/expect -f
# Steps to add it to your server:
# 1. Create autopass.sh in your home dir
# $ touch ~/autopass.sh
# 2. Change file permission of the file
# $ chmod 777 ~/autopass.sh
# 3. Add alias in your .bashrc (or .zshrc if you're using zsh)
# $ echo 'alias ap="~/autopass"' > ~/.bashrc
# 4. Reload your shell
@jumbosushi
jumbosushi / shared_dir_remmina.md
Last active January 13, 2019 01:31
How to create shared directory with Windows VM from Ubuntu via Remmina
View shared_dir_remmina.md

How to create a shared folder on Windows Remote Desktop accessed from Ubuntu via Remmina

As part of COMM335 at UBC, students use Microsoft Access via Remote Desktop if you use Mac. Unfortunately, they don't have a guide on Ubuntu (yet). I had some trouble creating a shared folder between faculty's Windows VM and my Ubuntu 16.04.

Specifically my local computer wasn't accessible from Access unlike how it was showed in the Mac guide.

mac_guide_pic

(Picture taken from faculty's guide for Mac)

@jumbosushi
jumbosushi / copy_gpg_key.sh
Created August 16, 2018 21:55
Copy gpg keys from backup
View copy_gpg_key.sh
mv ~/.gnupg ~/.new_gnupg
cp -r /backup/.gnupg ~cd .gnupg/
gpg --export-secret-keys > sec.gpg
rm -r ~/.gnupg
mv ~/.new_gnupg ~/.gnupg
gpg --import sec.gpg
@jumbosushi
jumbosushi / decrype.sh
Last active August 16, 2018 21:52
Decrypt all files
View decrype.sh
for file in *
do
gpg -d -o ~/backup_ungpg/$file.tar.gz "$file"
done
@jumbosushi
jumbosushi / postman_collection_avg.rb
Created June 26, 2018 17:28
Get average from postman collection results json
View postman_collection_avg.rb
require 'json'
def get_avg(num_array)
avg = num_array.instance_eval { reduce(:+) / size }
in_sec_f = avg / 1000
in_sec_f.round(3).to_s + " sec"
end
# 'vendor_index_api_responses' is dir that all responses are saved
all_results = Dir["#{Dir.home}/Documents/vendor_index_api_responses/*"]
@jumbosushi
jumbosushi / get_322_files.rb
Last active April 10, 2018 01:33
Download all 2018S CPSC322 files
View get_322_files.rb
require "open-uri"
# Last lec is 23, first is 01
# Ex Assignment link: https://www.cs.ubc.ca/~poole/cs322/2018/as1/as1.pdf
# EX Lec link: https://www.cs.ubc.ca/~poole/cs322/2018/slides/lect23s.pdf
def get_as_link(num)
return "https://www.cs.ubc.ca/~poole/cs322/2018/as#{num}/as#{num}.pdf"
end
def get_as_sol_link(num)
View keybase.md

Keybase proof

I hereby claim:

  • I am jumbosushi on github.
  • I am jumbosushi (https://keybase.io/jumbosushi) on keybase.
  • I have a public key whose fingerprint is 8AE0 7956 6449 9F08 CB99 4B3F 3AE6 3A6A 5E2A 2F09

To claim this, I am signing this object:

@jumbosushi
jumbosushi / get-cfg
Last active October 30, 2017 22:18
Pull dotfiles
View get-cfg
git clone --bare https://github.com/jumbosushi/dotfiles.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";