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/env python | |
""" | |
Includes a function for retrieving a public IP in a simple, programmatic fashion. | |
NOTE: Does not use HTTPS! | |
""" | |
import urllib2 | |
def get_public_ip(): | |
"""Retrieve the external IP address. |
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
struct node{ | |
// A node has two components: some data and a pointer to the next node. | |
int node_data; | |
node* next; | |
}; | |
int main(){ | |
// Make some nodes: | |
node A,B,C; |
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
#include <iostream> | |
using namespace std; | |
int preincrement(int & x){ | |
// Add one to x, and return the new value for x. | |
x = x+1; | |
return x; | |
} | |
int postincrement(int & x){ |
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
def exp(x,n): | |
"""Returns x^n, for integers x,n and n>=0 | |
This is done more intelligently, as we can use the definition | |
that x^(a/2)^2 == x^a to make many less multiplications""" | |
# count is the amount of multiplications. | |
count = 0 | |
result = 1 | |
x_raised = x | |
# On each iteration, multiply our result by x^a if x^a is needed to compute x^n. |
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
""" | |
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm | |
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | |
rights reserved. | |
License to copy and use this software is granted provided that it | |
is identified as the "RSA Data Security, Inc. MD5 Message-Digest | |
Algorithm" in all material mentioning or referencing this software | |
or this function. |
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
def lcs(str1, str2): | |
# If either string is empty, stop | |
if len(str1) == 0 or len(str2) == 0: | |
return "" | |
# First property | |
if str1[-1] == str2[-1]: | |
return lcs(str1[:-1], str2[:-1]) + str1[-1] | |
# Second proprerty |
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
def chunks(chunkable, n): | |
""" Yield successive n-sized chunks from l. | |
""" | |
for i in xrange(0, len(chunkable), n): | |
yield chunkable[i:i+n] |
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/env python | |
# Uploads every file in the directory to the specified FTP server | |
import os | |
import os.path | |
from ftplib import FTP | |
HOST = "127.0.0.1" | |
PORT = 21 |
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
""" | |
Steps: | |
1) Save the game before anything happens | |
2) Solve the game to get the list of mines, as y,x coordinates | |
3) Reconstruct the savegame | |
4) XOR the decoded savegame and the reconstructed save game to get the key | |
5) Build an exploit to steal the entire key. | |
6) Build an exploit to grab the flag | |
""" |
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 cv2 | |
from cv2 import cv | |
method = cv.CV_TM_SQDIFF_NORMED | |
template_name = "mozicon128.png" | |
image_name = "test2.jpeg" | |
# Load | |
needle = cv2.imread(template_name) |
OlderNewer