Skip to content

Instantly share code, notes, and snippets.

View potix2's full-sized avatar
:octocat:

Katsunori Kanda potix2

:octocat:
View GitHub Profile
@potix2
potix2 / fizzbuzz.sh
Created October 11, 2011 18:29
fizzbuzz
perl -e'map{print$_%3?$_%5?$_:"":"fizz",$_%5?"":"buzz","\n";}1..100'
@potix2
potix2 / gist:1290984
Created October 16, 2011 14:56
fill with same characters in PHP
//result: BBBBBBBBBB
implode('', array_fill(0, 10, 'B'));
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype on
set nocompatible
set autoindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
@potix2
potix2 / current working directory
Last active January 18, 2017 07:17
get a directory of the current script
echo $(cd $(dirname $0);pwd)

AWSでELB経由のリクエストに対してIPアドレスによるアクセス制限をかけたい

mod_extract_forwardedを使うといつも通りのアクセス制限が可能。

$sudo yum --enablerepo=epel install mod_extract_forwarded
$sudo vi /etc/httpd/conf.d/mod_extract_forwarded.conf

ファイルに下記設定を追加する。

#!/bin/sh
SRCDIR="resized/"
DESTDIR="resized/"
cd $SRCDIR;
for FILE in `ls *.jpg`;
do
echo $FILE
convert $FILE -channel R -separate $FILE
#!/bin/sh
SRCDIR="original/"
DESTDIR="resized/"
if [ ! -d "resized" ];
then
mkdir resized
fi
#!/usr/bin/perl -w
use strict;
use warnings;
use constant THRESHOLD => 50;
sub usage {
print "Usage calc_size.pl <width> <height> <original width> <original height>\n";
exit;
}
function! PutRelativePathsFromCWD()"{{{
let paths = split(substitute(getreg(), getcwd() ."/", "", "g"), '\n')
:call append(line('.'), paths)
endfunction"}}}
@potix2
potix2 / vim.rb
Created December 18, 2011 12:34 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.294'
def features; %w(tiny small normal big huge) end