Skip to content

Instantly share code, notes, and snippets.

@polikeiji
polikeiji / init.vim
Last active February 11, 2022 04:19
Neovim configuration for my Windows laptop
set incsearch
set hlsearch
set ts=4 sw=4 sts=0
set et
filetype plugin indent on
syntax enable
set path+=**
set backspace=indent,eol,start
set number
set relativenumber
@polikeiji
polikeiji / make_ps_compatible_for_bash.md
Last active May 9, 2021 02:53
How to make my PowerShell compatible with Bash to join open source projects.

Background

Recently, I've started trying to join open source projects using my Windows PC and I like to keep to use PowerShell as my shell environment.

But, unfortunately, some open source projects don't care of PowerShell users maybe because the number of PowerShell users is quite fewer than Bash (or other Unix shells).

For example, sometime NodeJS project includes these kind of package.json, and we can't execute npm run clean. PowerShell gives an alias to Remove-Item for rm, but its command options aren't compatible with rm's one.

"scripts": {
@polikeiji
polikeiji / export_chapters.sh
Created September 20, 2020 18:05
Export DVD chapters into separate movie files using HandBrakeCLI and jq.
#!/bin/bash
SOURCE=$1
DEST_BASE=$2
if [ -z $3 ]; then
SCAN_RESULT=$(HandBrakeCLI -i $SOURCE --scan -t 0 --json | sed '1,/JSON Title Set/d')
SCAN_RESULT=$(echo "{" $SCAN_RESULT)
echo $SCAN_RESULT >$DEST_BASE.json
else
SCAN_RESULT=$(cat $3)
fi
set incsearch
set hlsearch
set ts=4 sw=4 sts=0
set et
let mapleader="\<SPACE>"
filetype plugin indent on
syntax enable
@polikeiji
polikeiji / file0.txt
Last active December 24, 2017 13:12
Mac で Vim ベースの JavaScript 開発環境を整える (その 1) ref: https://qiita.com/polikeiji/items/b3845271a93f5304d119
brew install neovim
@polikeiji
polikeiji / file0.cs
Created August 22, 2016 03:14
スクリプトでUnityのStandardシェーダーのRendering Modeを変える ref: http://qiita.com/polikeiji/items/e56febcfdf886524352c
using UnityEngine;
using System.Collections;
public class BlendModeUtils : MonoBehaviour
{
public enum Mode
{
Opaque,
Cutout,
@polikeiji
polikeiji / file0.py
Created December 18, 2015 05:53
PythonでアスキーアートのGIFアニメーションを作る ref: http://qiita.com/polikeiji/items/2322f4980b417a657ce7
from PIL import Image, ImageDraw, ImageFont
import os.path
import os
import commands
FONT_SIZE = 12
GRID_SIZE = (3, 2)
FONT_COLOR_SET = ("#ffffff", "#000000")
FONT_PATH = 'フォント(等幅)のパス'
@polikeiji
polikeiji / file0.py
Created November 26, 2015 12:02
SeleniumでPhantomJSを使う時に画像を読み込まない方法 ref: http://qiita.com/polikeiji/items/457387c5db879f17a4c0
from selenium.webdriver import PhantomJS
driver = PhantomJS(service_args=['--load-images=no'])
driver.get('http://xxxxxx.xxxxx')
@get('/twitter_login')
def twitter_login():
auth_url, request_token_key, request_token_secret = twitter.generate_auth_url()
# request_token_keyとrequest_token_secretをセッションに保存する。
redirect(auth_url)
@polikeiji
polikeiji / server.py
Last active July 8, 2022 01:26
Github、Bitbucketとのデプロイ連携するときのBottle用のテンプレート ref: http://qiita.com/polikeiji/items/fc6f9bbe7a619a053319
# -*- coding: utf-8 -*-
import commands
import os.path
import traceback
from decorator import decorator
import logging
import subprocess
import getpass