This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1d94e295d4514f2a509d3b608b515e08e04d4577 Mon Sep 17 00:00:00 2001 | |
From: Leo Ju <[email protected]> | |
Date: Sun, 16 Aug 2009 21:00:21 +0900 | |
Subject: [PATCH] Added format string %r to show subversion revision | |
--- | |
src/vcprompt.c | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/src/vcprompt.c b/src/vcprompt.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo vim -e /etc/apt/sources.list <<EOF | |
%s/kr.archive.ubuntu.com/ftp.daum.net/g | |
w | |
q | |
EOF | |
sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each do |num| | |
claps = 0 | |
num.to_s.each_char { |c| claps += 1 if /[369]/.match(c) } | |
word = claps > 0 ? 'clap! ' * claps : num | |
print "#{word}," | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AesTest { | |
@Test | |
public void stringCanBeEncripted() throws NoSuchAlgorithmException, NoSuchProviderException, | |
NoSuchPaddingException, InvalidKeyException, ShortBufferException, IllegalBlockSizeException, BadPaddingException { | |
String original = "Kiwiple Inc."; | |
AesToy aes = new AesToy(); | |
String encrypted = aes.encrypt(original); | |
System.out.println("encrypted: " + encrypted); | |
String decrypted = aes.decrypt(encrypted); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modified version of http://www.androidsnippets.com/encryptdecrypt-strings | |
import java.security.SecureRandom; | |
import javax.crypto.Cipher; | |
import javax.crypto.KeyGenerator; | |
import javax.crypto.SecretKey; | |
import javax.crypto.spec.SecretKeySpec; | |
public class AesCrypto { | |
private static String secret = "Sulley#@Wazowski$%"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def serialize_types(types, ratios) | |
serialized = "" | |
types.each_with_index do | type, i | | |
occurrences = (ratios[i] * 100).to_i | |
serialized += type * occurrences | |
end | |
serialized | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'date' | |
require 'apachelogregex' | |
# apache log format | |
parser = ApacheLogRegex.new('%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %I %b %D') | |
File.open(ARGV[0]).readlines.each do | line | | |
p = parser.parse(line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in a eclipse project's bin directory | |
java -cp .:`for jar in ../lib/*; do echo -n $jar:; done` com.leoju.clitoy.MainHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# haproxy tcp/http proxy daemon | |
# | |
# chkconfig: <default runlevel(s)> <start> <stop> | |
# description: tcp/http proxy daemon, installed for ESG server proxy | |
# | |
### BEGIN INIT INFO | |
# Provides: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu upstart file at /etc/init/mongodb.conf | |
limit nofile 32768 32768 | |
kill timeout 300 # wait 300s between SIGTERM and SIGKILL. | |
pre-start script | |
mkdir -p /data/mongodb &> /dev/null | |
mkdir -p /data/logs/mongo &> /dev/null | |
chown mongodb:nogroup /data/mongodb &> /dev/null |
OlderNewer