Skip to content

Instantly share code, notes, and snippets.

@takumikinjo
takumikinjo / Vagrantfile
Last active August 29, 2015 14:02
Vagrantfile for my base Box
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@takumikinjo
takumikinjo / Dockerfile
Last active July 8, 2019 06:53
Dockerfile for Apache2
FROM ubuntu:latest
MAINTAINER Takumi Kinjo
RUN apt-get update
RUN apt-get check
RUN apt-get dist-upgrade -y
RUN apt-get install -y apache2
# See http://www.kstaken.com/blog/2013/07/06/how-to-run-apache-under-docker/
@takumikinjo
takumikinjo / .gitignore
Last active August 29, 2015 14:01
Vagrantfile for Docker on Ubuntu 14.04 in OkinawaDevOps
.vagrant
@takumikinjo
takumikinjo / outlinefill.pl
Last active January 2, 2016 23:09
Fill the columns of a outline text.
#!/usr/bin/env perl
# outlinefill.pl <outline indent chars> <output delimiter>
@b = ();
while (<STDIN>) {
chomp;
@a = split /$ARGV[0]/, $_;
@b = () if ($#a < $#b);
@takumikinjo
takumikinjo / myrc
Created October 31, 2012 17:17
My favorite shell functions.
# . <(curl -L http://goo.gl/pdDKD)
# e.g.: jked /etc/hosts:3:
function jked {
file=`echo "$@" | sed 's/[:]/ /g' | awk '{print $1}'`
n=`echo "$@" | sed 's/[:]/ /g' | awk '{print $2}'`
if echo "$n" | grep '^[0-9]*$'; then
vi "$file" +"$n"
else
vi "$file"
@takumikinjo
takumikinjo / .gitignore
Last active March 10, 2024 10:33
my favorite elisps
*.elc
@takumikinjo
takumikinjo / README
Created September 29, 2012 12:27
Register users and memberships to Redmine
Register users and memberships to Redmine.
@takumikinjo
takumikinjo / startup.sh
Created June 3, 2012 09:46
startup script for my rails app dev
#!/usr/bin/env bash
# tested on ubuntu12.04 server
# this cannot perform on lion. lion's ed command does not have 'y' command.
# rails new my-app
# cd my-app
# bash < <(curl -s https://raw.github.com/gist/2862788/ed729517cc94c3c3aee44bdbec1f3039184d5181/startup.sh)
git init
@takumikinjo
takumikinjo / enake-camel.el
Created April 2, 2012 14:28
snake-case/camel-case elisp functions
;; Usage:
;;
;; (defun snake-camel () (interactive)(kill-new(upcase-first(snake-to-camel(car kill-ring)))))
;; (defun camel-snake () (interactive)(kill-new(upcase(camel-to-snake(car kill-ring)))))
(defun snake-to-camel (s)
""
(setq s (downcase s))
(if (string-match "_" s)
(concat (let ((fs (substring s 0 (match-beginning 0))))
@takumikinjo
takumikinjo / lambda-and-proc.rb
Created February 29, 2012 15:15
lambda-and-proc
# -*- coding: utf-8 -*-
# lambda で Proc オブジェクトを作る
def foo(v)
f = lambda { |a, b|
puts "#{a}, #{b}, #{v}"
}
end
# Proc.new で Proc オブジェクトを作る
def bar(v)