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 org.apache.commons.io.FileUtils; | |
public class Compare { | |
public static boolean recursiveContentCompare(File path1, File path2) throws Exception { | |
boolean result = true; | |
if (path1.exists() && path2.exists()) { | |
if (path1.isFile() && path2.isFile()) { | |
return FileUtils.contentEquals(path1, path2); | |
} 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
import java.util.*; | |
public class GetInfo { | |
public static void main(String[] args) { | |
Properties p = System.getProperties(); | |
// p.list(System.out); | |
System.out.println("Total CPU: " + Runtime.getRuntime().availableProcessors()); | |
System.out.println("Free memory: " + Runtime.getRuntime().freeMemory()); | |
} | |
} |
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/python | |
""" | |
This is a program to send emails to Scram email testing accounts | |
""" | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEText import MIMEText | |
from email.MIMEBase import MIMEBase | |
from email import encoders | |
import time |
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 loremipsum import get_sentences | |
import random | |
sentences_list = get_sentences(500) | |
flen = 5000000 | |
progress = -1 | |
with open('myfile.txt', 'w') as myfile: | |
for i in range(flen): | |
n = round(i/(flen/100)) |
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/python | |
""" | |
Create heterogeneous Hadoop cluster | |
Contains of 4 nodes in two different racks | |
""" | |
from mininet.net import Containernet | |
from mininet.node import Controller | |
from mininet.cli import CLI | |
from mininet.link import TCLink | |
from mininet.log import info, setLogLevel |
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 requests | |
import json | |
def getJSON(url): | |
r = requests.get(url) | |
return json.loads(r.text) | |
server = 'http://d1:19888' | |
url = server + '/ws/v1/history/mapreduce/jobs' |
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.IOException; | |
import java.util.StringTokenizer; | |
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.io.IntWritable; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapreduce.Job; | |
import org.apache.hadoop.mapreduce.Mapper; | |
import org.apache.hadoop.mapreduce.Reducer; |
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/python | |
""" | |
Create heterogeneous Hadoop cluster | |
Contains of 4 nodes in two different racks | |
""" | |
from mininet.net import Containernet | |
from mininet.node import Controller | |
from mininet.cli import CLI | |
from mininet.link import TCLink | |
from mininet.log import info, setLogLevel |
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.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class MyClass | |
{ | |
public static void main (String[] args) throws java.lang.Exception | |
{ | |
int[] a = {1,2,3}; | |
int[] b = {1,3,5}; |
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/python | |
""" | |
Create a mininet network and start sshd(8) on each host. | |
While something like rshd(8) would be lighter and faster, | |
(and perfectly adequate on an in-machine network) | |
the advantage of running sshd is that scripts can work | |
unchanged on mininet and hardware. | |
In addition to providing ssh access to hosts, this example | |
demonstrates: |