Skip to content

Instantly share code, notes, and snippets.

View dodyw's full-sized avatar
🎯
Focusing

Dody RW dodyw

🎯
Focusing
View GitHub Profile
@dodyw
dodyw / gist:6142519
Created August 2, 2013 19:09
chef install
gem install chef ruby-shadow --no-ri --no-rdoc
@dodyw
dodyw / sdcard.sh
Created July 5, 2013 07:52
Create android vd and add writeable sdcard
android create avd -n my_avd -t 7
mksdcard -l e 512M mysdcard.img
emulator -avd my_avd -sdcard mysdcard.img
// parse nik
Pattern p = Pattern.compile("([0-9]+)");
Matcher m = p.matcher(nik_);
while (m.find()) { // Find each match in turn; String can't do this.
nik += m.group(1) + "";
}
// parse rt rw
public String cleanupNonAlphanumeric(String s) {
return s.replaceAll("[^A-Za-z0-9\\.\\s]", "");
}
@dodyw
dodyw / gist:5801623
Created June 18, 2013 00:07
Command sequence to install redis on fedora. Redis location will be /opt/redis. Replace 2.6.13 with the redis latest version.
cd /opt/
mkdir /opt/redis
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
tar -zxvf /opt/redis-2.6.13.tar.gz
cd /opt/redis-2.6.13/
make
cp /opt/redis-2.6.13/redis.conf /opt/redis/redis.conf.default
cp /opt/redis-2.6.13/src/redis-benchmark /opt/redis/
cp /opt/redis-2.6.13/src/redis-cli /opt/redis/
@dodyw
dodyw / redis.conf
Created June 18, 2013 00:05
redis conf with 20MB memory usage and as cache (memcached replacement)
daemonize yes
pidfile /var/run/redis.pid
logfile /var/log/redis.log
port 6379
bind 127.0.0.1
timeout 300
loglevel notice
@dodyw
dodyw / gist:5801595
Created June 18, 2013 00:02
Set redis as daemon. Get init-rpm.sh here: https://gist.github.com/dodyrw/5801564
cd /opt
useradd -M -r --home-dir /opt/redis redis
mv /opt/init-rpm.sh /etc/init.d/redis
chmod +x /etc/rc.d/init.d/redis /etc/init.d/redis
chown -R redis:redis /opt/redis
touch /var/log/redis.log
chown redis:redis /var/log/redis.log
chkconfig --add redis
chkconfig redis on
@dodyw
dodyw / init-rpm.sh
Last active December 18, 2015 14:59 — forked from anonymous/gist:5801559
script to start and stop redis as daemon - tested on fedora
#!/bin/sh
#
# script to start and stop redis as daemon
#
# chkconfig: - 85 15
# description: redis is a non-relational database storage system.
# processname: redis
# config: /opt/redis/redis.conf
# binary: /opt/redis/redis-server
@dodyw
dodyw / rows.php
Last active December 15, 2015 00:59 — forked from anonymous/rows.php
<img class="thumbnail alignleft" src="http://images.thumbshots.com/image.aspx?cid=xxxxx&v=1&w=120&url=<?php print urlencode($v['url']) ?>" border="1" alt="<?php print $v['title'] ?>" />
@dodyw
dodyw / rows_detail.php
Created March 16, 2013 14:31
thumbshots
<img src="http://images.thumbshots.com/image.aspx?cid=xxxxx&v=1&w=120&url=<?php print urlencode($v['url']) ?>" alt="<?php print $v['title'] ?>" style="border:1px solid #777;float:left;">