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
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import javax.microedition.io.Connector; | |
import javax.microedition.io.file.FileConnection; | |
import net.rim.device.api.system.Bitmap; | |
import net.rim.device.api.system.EncodedImage; |
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
Had this one case, ping is correct, but telnet to server failed | |
Check with tcpdump from server if your checksum is invalid. | |
if lots of invalid checksump, just run this command | |
#turn off checksum | |
/sbin/ethtool --offload em2 rx off tx off |
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
<?php | |
class QueryIterator implements Iterator | |
{ | |
private $position = 0; | |
private $rows=array(); | |
private $result = NULL; | |
public function __construct($sql) | |
{ |
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
<?php | |
function aes_cbc_encrypt($data, $key) | |
{ | |
$size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); | |
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM); | |
$key = hash('SHA256', $key, true); | |
$strIn = pkcs5_pad($data); | |
$strCrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $strIn, MCRYPT_MODE_CBC, $iv); | |
return base64_encode($iv.$strCrypt); |
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
<?php | |
putenv('AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXX'); | |
putenv('AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); | |
putenv("JAVA_HOME=/usr/lib/jvm/jre"); | |
$ec2_bin="/opt/aws/bin"; | |
$my_cert="/home/ec2-user/cert-xxx.pem"; | |
$my_key="/home/ec2-user/pk-xxx.pem"; | |
$instance_id=file_get_contents('http://169.254.169.254/latest/meta-data/instance-id'); |
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
<?php | |
//https://github.com/PHPMailer/PHPMailer | |
require 'class.phpmailer.php'; | |
require 'class.smtp.php'; | |
$mail = new PHPMailer(); | |
$mail->CharSet = 'UTF-8'; | |
$mail->IsSMTP(); | |
$mail->SMTPDebug = 1; |
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/bash | |
file="file-to-backup.gz" | |
contentType="application/x-gzip" | |
bucket="bucketname" | |
region="ap-southeast-1" | |
resource="/${bucket}/${file}" | |
dateValue=`date -R` | |
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}" |
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 apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texinfo zlib1g-dev cmake mercurial nasm | |
mkdir ~/ffmpeg_sources | |
#yasm | |
cd ~/ffmpeg_sources | |
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz | |
tar xzvf yasm-1.3.0.tar.gz | |
cd yasm-1.3.0 | |
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" | |
make |