Skip to content

Instantly share code, notes, and snippets.

@okbm
okbm / mac set up.md
Last active February 11, 2018 02:56

ツール

ソフト管理

  • Alfred
    • ショートカットのランチャー。何かと便利
  • Clipy
    • コピーをしてる内容を保持しておいて、選択してペーストできるツール
  • CotEditor
  • シンプルなエディタ。メモとかに使うのにすごく便利だし、正規表現とか覚えるといろいろ捗るのでオススメ
import urllib.parse
import urllib.request
import json
from xml.sax.saxutils import unescape # エスケープされた記号を戻す
url = "https://slack.com/api/im.history?" # https://api.slack.com/methods/im.history
def create_params(ts = None):
params = {'token': 'xxxxx',
'channel': 'xxxxx',
$ rbenv local 2.5.1
$ ruby -v
ruby 2.5.1

$ gem install bundler
$ mkdir my_project
$ cd my_project
$ bundle init
@okbm
okbm / hatebu.rb
Created July 10, 2016 08:15
はてぶ棚卸しに使えそうなruby ワンライナー
require 'net/https'
require 'uri'
time = Time.now - 24*60*60 * 180
url = "http://b.hatena.ne.jp/okbm/atomfeed?date=#{time.strftime('%Y%m%d')}"
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
@okbm
okbm / tips.md
Last active April 6, 2017 00:28
よく忘れるtips的な何か

git

masterブランチにマージされたローカルブランチを削除する

git br --merged | grep -v '^\*' | grep -v master | xargs git br -d

git管理外のファイル抹殺

git co . && git clean -df
@okbm
okbm / meme.md
Last active August 29, 2015 14:15
mysqlがtimeoutする(2006のエラー)
$ mysql 

mysql > SHOW VARIABLES LIKE 'max_allowed_packet';

# cnfの場所
$ mysql --help | grep my.cnf
                order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 
@okbm
okbm / mac_python3_install.md
Last active November 14, 2017 06:24
macにpyenvでpython3いれる

mac でpython3の最新入れる

$ brew install pyenv-virtualenv

# zshrcに追加
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"

$ cd tmp
@okbm
okbm / Varantfile
Last active August 29, 2015 14:05
vagrantでのpythonのインストール(2.7系と3.4系)
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "vagrant-python-dev"
config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_debian-7.1.0_provisionerless.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
#!/bin/sh
function print_help () {
cat <<__EOF__
Usage: sh $0
簡易デプロイシェル
1) git fetch -p && git checkout master && git pull
2) DocumentRoot以下にrsyncするだけ
Options
-h, --help show this message
#!/bin/bash
function print_help () {
cat <<__EOF__
Usage: $0 <opt> <path>
Options
-n dryrun
-h, --help show this message
__EOF__
}