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 Sorts.InsertionSort; | |
import java.util.Scanner; | |
public class BinarySearch { | |
public int binarySearch(Comparable[] a, Comparable key) { | |
int low = 0, high = a.length - 1,mid; | |
while (low <= high) { | |
mid = low + (high - low) / 2; | |
if(key.compareTo(a[mid])< 0 ) high = mid -1; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<script language="javascript" type="text/javascript" > | |
function jumpto(x){ | |
if (document.form1.jumpmenu.value != "null") { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<input type="button" value="Reload Page" onClick="document.location.reload(true)"> | |
</form> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<script type="text/javascript"> | |
// Popup window code | |
function newPopup(url) { | |
popupWindow = window.open( | |
url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<script language="javascript"> | |
var popupWindow = null; | |
function centeredPopup(url,winName,w,h,scroll){ | |
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; | |
TopPosition = (screen.height) ? (screen.height-h)/2 : 0; |
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 java.awt.Color; | |
import java.awt.Graphics; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.SwingUtilities; | |
/** | |
* @author psychocoder |
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
clc | |
clear all | |
[x, y, z] = meshgrid(-10:0.05:10,-10:0.05:10,-10:0.05:10); | |
r = power((power(x,2) + ((9/4).*power(y,2)) + power(z,2) - 1),3) - (power(x,2).*power(z,3)) - ((9/80).*(power(y,2).*power(z,3))); | |
p = patch(isosurface(x,y,z,r,0)); | |
set(p,'facecolor','red','EdgeColor','none'); | |
daspect([1,1,1]); | |
view(3); | |
axis off; | |
camlight('right') |
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
def merge(left, right): | |
result = [] | |
n, m = 0, 0 | |
while n < len(left) and m < len(right): | |
if left[n] <= right[m]: | |
result.append(left[n]) | |
n += 1 | |
else: | |
result.append(right[m]) | |
m += 1 |
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 socket | |
import random | |
sent=0 | |
socket=socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
ip=raw_input('Target IP Address: ') | |
port=input("Please enter a port: ") | |
num_bytes=input('Please enter data size in bytes: ') | |
bytes=random._urandom(num_bytes) | |
addr=(ip,port) |
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 hashlib | |
""" | |
Encrypts given string | |
Method: md5, sha1, sha224, sha256, sha384, sha512 | |
Supports: Salts | |
How to use: encrypt('password', 'sha512', '04/16/2010') | |
""" |