This file contains hidden or 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
LdapContextSource cs = new LdapContextSource(); | |
cs.setUrl("ldap://127.0.0.1:389"); | |
cs.setBase("OU=XX,DC=YY,DC=com"); | |
cs.setUserDn("CN=appCN,OU=XX,DC=YY,DC=com"); | |
cs.setPassword("appPassword"); | |
cs.afterPropertiesSet(); | |
LdapTemplate lt = new LdapTemplate(cs); | |
AndFilter filter = new AndFilter(); | |
filter.and(new EqualsFilter("mail", "userEmail@somedomain")); | |
System.out.println(lt.authenticate(DistinguishedName.EMPTY_PATH, filter.toString(), userPassword)); //true means valid login |
This file contains hidden or 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
ips=`cat ips.txt` | |
masterPublic=`echo $ips | cut -f1 -d " "` | |
masterPrivate=`echo $ips | cut -f2 -d " "` | |
rm -rf hostsFile | |
echo "$masterPrivate hmaster" > hostsFile | |
rm -rf slavesFile | |
touch slavesFile | |
iparray=(`cat ips.txt`) |
This file contains hidden or 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
package util; | |
import static com.google.common.base.Charsets.UTF_8; | |
import static com.google.common.base.Preconditions.checkArgument; | |
import static com.google.common.base.Predicates.not; | |
import static com.google.common.collect.Iterables.concat; | |
import static com.google.common.collect.Iterables.contains; | |
import static com.google.common.collect.Iterables.getOnlyElement; | |
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE; | |
import static org.jclouds.compute.options.TemplateOptions.Builder.overrideLoginCredentials; | |
import static org.jclouds.compute.options.TemplateOptions.Builder.runScript; |
This file contains hidden or 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
PROVIDER=hpcloud-compute (jcloud provider id) | |
IDENTITY=API-User-ID | |
CREDENTIAL=API-Password | |
MASTER_IMAGE_ID=Prebuilt Hadoop Master Image ID | |
SLAVE_IMAGE_ID=Prebuilt Hadoop Slave Image ID | |
SECURITY_GROUP=Security Group ID (allow required hadoop ports to access the Web GUI using Master Public IP) | |
SERVER_GROUP=Server Group ID (Useful for termination) | |
KEYPAIR=SSH KeyPair | |
NUM_SLAVES=Number of Hadoop Slaves |
This file contains hidden or 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 void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
Handler handler = new Handler(); | |
handler.postDelayed(new Runnable() { | |
public void run() { | |
finish(); | |
Intent intent = new Intent(MainActivity.this, MenuActivity.class); | |
MainActivity.this.startActivity(intent); | |
} |
This file contains hidden or 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 void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
Thread thread = new Thread() { | |
public void run() { | |
try { | |
Thread.sleep(3*1000); | |
} catch (Exception e) {} | |
finish(); |
This file contains hidden or 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
<script> | |
function start() { | |
var connection = new WebSocket('ws://localhost:8888/websocket'); | |
connection.onopen = function () { | |
alert('open'); | |
}; | |
} | |
</script> | |
<html> | |
<body onload="javascript:start();"> |
This file contains hidden or 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 | |
rm -rf t | |
while true | |
do | |
read packet | |
echo $packet >> t | |
cnt=`echo $packet | wc -c` | |
if [ $cnt == 2 ] #end of message | |
then | |
key=`cat t | grep "Sec-WebSocket-Key:" | cut -f2 -d " "` |
This file contains hidden or 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 com.google.gdata.client.GoogleService; | |
import com.google.gdata.client.authn.oauth.*; | |
import com.google.gdata.data.BaseEntry; | |
import com.google.gdata.data.BaseFeed; | |
import com.google.gdata.data.Feed; | |
import java.io.*; | |
import java.net.*; | |
import javax.net.ssl.*; | |
public class PPB { |