Skip to content

Instantly share code, notes, and snippets.

@clairvy
clairvy / README.md
Last active August 29, 2015 14:05 — forked from koshigoe/mymemcheck.rb

my.cnf memory check

  1. my.cnf か SHOW VARIABLES の結果を入力にとる
  2. 入力を解析し、必要なパラメータ値を取得する
  3. 計算
  4. 結果を標準出力に出力する
#!/bin/sh
# Copyright (c), Naruse Motoki (motoki@naru.se)
# Licensed under The MIT License
dryrun=`git push -n 2>&1`
echo "$dryrun"
fromto=`echo $dryrun | sed -e "s/.* \([0-9a-z]\+\.\.[0-9a-z]\+\) .*/\1/g"`
if expr "$fromto" : "^[0-9a-z]\+\.\.[0-9a-z]\+$" >/dev/null; then
echo "`git log --date=short --pretty=format:"%h %ad %an %s" $fromto`"
fi
@clairvy
clairvy / zsh.zsh
Created September 22, 2010 13:08 — forked from hchbaw/zsh.zsh
#!zsh
# __git_branch_switches
# _git-submodule
# _git-filter-branch
(( $+functions[_git-now] )) ||
_git-now () {
local curcontext=$curcontext state line
declare -A opt_args
;;; pit.el --- Manipulate pit data.
;; Copyright (C) 2008 Takeru Naito
;; Author: Takeru Naito <takeru.naito@gmail.com>
;; Original: cho45 http://lowreal.rubyforge.org/pit/
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 2, or (at your
;; option) any later version.
#!/usr/bin/env perl
# -*- coding: utf-8-unix; -*-
use strict;
use warnings;
use Config::Pit;
use Net::Growl;
use WWW::Mechanize;