Skip to content

Instantly share code, notes, and snippets.

View n0ts's full-sized avatar
🏠
Working from home

Naoya Nakazawa n0ts

🏠
Working from home
  • Freelancer
  • Tokyo, Japan
  • X @n0ts
View GitHub Profile
@n0ts
n0ts / gist:2576613
Created May 2, 2012 13:45
RMagick vs quick_magic vs mini_magick
user system total real
RMagick 0.850000 0.140000 0.990000 ( 0.560273)
quick_magick 0.030000 0.030000 0.190000 ( 0.256925)
mini_magick 0.020000 0.030000 1.260000 ( 0.825334)
@n0ts
n0ts / ruby-mode.el.patch
Created May 8, 2012 01:36
ruby-mode.el.patch
@@ -1144,7 +1144,12 @@
(4 (7 . nil)))
;; $' $" $` .... are variables
;; ?' ?" ?` are ascii codes
- ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
+ ;("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
+ ("\\([?$]\\)[#\"'`]"
+ (1 (unless (save-excursion
+ ;; Not within a string.
+ (nth 3 (syntax-ppss (match-beginning 0))))
@n0ts
n0ts / .rpmmacros
Created May 12, 2012 23:20
example of .rpmmarcors
%_topdir %(echo $HOME)/rpmbuild
%_smp_mflags -j3
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
%debug_package %{nil}
%dist .el6
@n0ts
n0ts / gist:2779745
Created May 24, 2012 06:06
CentOS-SRPM.repo
[base-SRPM]
name=CentOS-5.8 - Base SRPM
baseurl=http://vault.centos.org/5.8/os/SRPMS/
gpgcheck=0
[updates-SRPM]
name=CentOS-5.8 - Updates SRPM
baseurl=http://vault.centos.org/5.8/updates/SRPMS/
gpgcheck=0
@n0ts
n0ts / gist:2868708
Created June 4, 2012 14:23
Convert bridge network interface
for iface in /etc/sysconfig/network-scripts/ifcfg-eth*; do
iface_name=`egrep "^DEVICE=" \$iface`
iface_no=\${iface_name\#\#DEVICE=eth}
iface_br=ifcfg-br\${iface_no}
cp \$iface \$iface_br
sed -i -e "s/^DEVICE=eth\${iface_no}/DEVICE=br\${iface_no}/g" \$iface_br
sed -i -e 's/^HWADDR=/#HWADDR=/g' \$iface_br
echo "TYPE=Bridge" >> \$iface_br
sed -i -e "s/^BOOTPROTO=/#BOOTPROTO=/g" \$iface
@n0ts
n0ts / gist:2880326
Created June 6, 2012 06:50
m* mysqlbrew or myenv(仮) 構想
* 概要
- 複数の MySQL を手軽にインストールして、手軽に MySQL を使えるツール
* 要件
- 手軽にインストール/アップグレードができる
- U*INX で動作する
- バイナリでも展開して利用できるようにする
- mysql-build https://github.com/kamipo/mysql-build と連携して、自分でビルドした MySQL も使用できる
-- MySQL Sandbox の使いにくいところ(特にかなり既存の my.cnf を上書きしているところ)を改善したい
@n0ts
n0ts / gist:2893150
Created June 8, 2012 02:31
ifcfg-eth* ONBOOT
for iface in `ls /etc/sysconfig/network-scripts/ifcfg-eth*`; do
bootproto=`/bin/cat $iface | /bin/egrep "BOOTPROTO=.*" | /bin/cut -d "=" -f 2`
if [ "$bootproto" == "dhcp" ]; then
/bin/sed -i 's/ONBOOT=yes/ONBOOT=no/g' $iface
fi
done
@n0ts
n0ts / gist:3038229
Created July 3, 2012 07:17
Convert all tables to InnoDB
#!/bin/sh
DATABASENAME="<DATABASE>"
for t in `echo "show tables" | mysql -u root --batch --skip-column-names $DATABASENAME`; do
echo "table name is $t"
mysql $DATABASENAME -u root -e "ALTER TABLE $t ENGINE = InnoDB;";
done
@n0ts
n0ts / gist:3052011
Created July 5, 2012 07:28
PHP 5.4.4 + MySQL 5.5
export LDFLAGS=-L/usr/lib64/mysql
@n0ts
n0ts / gist:3057942
Created July 6, 2012 03:47
php53.spec diff
--- php53.spec-org 2012-06-15 04:26:17.000000000 +0900
+++ php53.spec 2012-07-06 12:30:57.000000000 +0900
@@ -12,11 +12,11 @@
%global httpd_mmn %(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)
# Regression tests take a long time, you can skip 'em with this
-%{!?runselftest: %{expand: %%global runselftest 1}}
+%{!?runselftest: %{expand: %%global runselftest 0}}
# Use the arch-specific mysql_config binary to avoid mismatch with the