Skip to content

Instantly share code, notes, and snippets.

View uplus's full-sized avatar
🌏
Working from the earth

Yuto Ito uplus

🌏
Working from the earth
View GitHub Profile
git rev-list HEAD...master --left-only | git diff-tree --no-commit-id --name-only --stdin | uniq
setup_my_tmp() {
TMPDIR=/private/my_tmp
sudo mkdir -p "${TMPDIR}"
sudo mount_tmpfs "${TMPDIR}"
sudo chmod 1777 "${TMPDIR}"
export TMPDIR
}
if [[ $(stat -c '%a' '/private/my_tmp') = 1777 ]]; then
export TMPDIR='/private/my_tmp'
" set debug=throw
" git ls-files | grep -Ev 'init.vim|.gitignore' | xargs rm
language message C
scriptencoding utf-8
set shell=/bin/sh
let g:netrw_nogx = 1
let g:loaded_node_provider = 0
if let Some(cookies) = req.headers.get::<iron::headers::Cookie>() {
for cookie in cookies.iter() {
// cookie is &String
if let Ok(cookie) = cookie::Cookie::parse(&cookie) {
// cookie is &Cookie
println!("{:?}", cookie);
}
}
};
function g:RubyBlockOneline(strs, cnt, def) abort
s/\v\s*do\s*(\|.*\|)?\_s*(.*)\_s*end/{\1 \2}
endfunction
function g:RubyBlockMultiline(strs, cnt, def) abort
let save_pos = getpos('.')
s/\v\s*\{(\|.*\|)?\_s*(.*)\_s*\}$/ do \1\r\2\rend
call feedkeys('3==')
call setpos('.', save_pos)
endfunction
@uplus
uplus / colors.sh
Last active December 13, 2016 13:25
colorso () {
local c
echo
for c in {000..255}
do
echo -n "\e[38;5;${c}m $c"
[ $(($c%16)) -eq 15 ] && echo
done
echo
}
echo_color(){
color="${1}"
shift
echo -e "\e[38;5;${color}m${*}\e[00m"
}
@uplus
uplus / proxy-on.sh
Last active September 24, 2017 04:28
proxy-on () {
proxy="${1:? server:port}"
export http_proxy="${proxy}"
export https_proxy="${proxy}"
export ftp_proxy="${proxy}"
export rsync_proxy="${proxy}"
export all_proxy="${proxy}"
export HTTP_PROXY="${proxy}"
export HTTPS_PROXY="${proxy}"
export FTP_PROXY="${proxy}"
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, const char* argv[]){
int n = argc == 1? 1: atoi(argv[1]);
if(n%15 == 0) cout << "FizzBuzz" << endl;
else if(n%3 == 0) cout << "Fizz" << endl;
function! s:bufdo(bufname, cmd) abort
let wn = bufwinnr(a:bufname)
if wn == -1
return 0
endif
exe wn 'wincmd w'
exe a:cmd
wincmd p
endfunction