Skip to content

Instantly share code, notes, and snippets.

@higemaru
higemaru / gist:7115419
Created October 23, 2013 09:27
Calculate Bowling Score
package Bowling::Score;
use strict;
use warnings;
sub new {
my $class = shift;
my @args = @_;
my $args_ref = ref $args[0] eq 'HASH' ? $args[0] : {@args};
@higemaru
higemaru / txt_graph.lua
Created August 1, 2013 13:59
CUI bar graph sample
#!/usr/bin/lua
maxnum = tonumber(arg[1]) or 40
max, min = 0, 0
lines = io.stdin:lines()
arrays = {}
for line in lines do
-- split
local tmps = {}
@higemaru
higemaru / txt_graph.lua
Created August 1, 2013 13:52
CUI bar graph sample
#!/usr/bin/lua
maxnum = tonumber(arg[1]) or 40
max, min = 0, 0
lines = io.stdin:lines()
arrays = {}
for line in lines do
-- split
local tmps = {}
#!/bin/bash
if [ $# -eq 0 ];then
echo 'USAGE: '$0' [second] command....'
exit;
fi
_CMD="$@"
_TIME=5
if [ $# -gt 1 ];then
@higemaru
higemaru / gist:5863873
Last active April 19, 2021 11:25
GIT_COMMITTER_DATE / GIT_AUTHOR_DATE
export GIT_COMMITTER_DATE="Fri Jun 21 20:26:41 2013 +0900"
git commit --amend --date "Fri Jun 21 20:26:41 2013 +0900" -m 'fix committer_date and author_date'
unset GIT_COMMITTER_DATE
export GIT_COMMITTER_DATE="2013-08-01 23:01:01 +0900"
git commit --amend --date "2013-08-01 23:01:01 +0900" -m 'fix committer_date and author_date'
unset GIT_COMMITTER_DATE
@higemaru
higemaru / jpg2pdf.sh
Created June 2, 2013 11:40
* jpg2pdf * jpg dirname = pdf filename = pdf meta title * Sony Reader resolution = 584 x 754
#!/bin/bash
_DIR="$1";
_NAME=`basename $_{DIR}`
_OIFS=${IFS}
IFS="
"
cd "$_{DIR}";
@higemaru
higemaru / get_maxclients.sh
Last active December 17, 2015 18:28
Apache MAXCLIENTS
#!/bin/bash
_MEM_INFO=`cat /proc/meminfo`
_MEM_TOTAL=`echo "$_MEM_INFO" | grep MemTotal | awk '{print $2}'`
_MEM_FREE=`echo "$_MEM_INFO" | egrep '(MemFree|Inactive):' | awk '{v += $2} END {print v}'`
_RSS_TOTAL=0
_SHARED_TOTAL=0
_PROC_COUNT=0