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 struct | |
def dns(capturefile, outputfile): | |
domains = [] | |
cap = open(capturefile, 'rb') | |
cap.read(24) | |
try: | |
while True: | |
cap.read(8) |
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
# Block a specific MAC address on the D-Link DSL-2750U (using parental control). | |
# May also work for other/similar D-Link routers (eg; 27xx) | |
import urllib,urllib2 | |
import random,json,re | |
import base64 | |
# Modify as necessary | |
login = base64.b64encode('admin:password') # username:password | |
mac = '00:00:00:00:00:00' # MAC address to block in the form xx:xx:xx:xx:xx:xx |
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 pygame import gfxdraw | |
import sys,pygame | |
pygame.init() | |
screen = pygame.display.set_mode((400,400)) | |
screen.fill((0,0,0)) | |
pygame.display.flip() | |
white = (255,255,255) | |
def symmetry(x,y): |
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 sys,pygame | |
from pygame import gfxdraw | |
pygame.init() | |
screen = pygame.display.set_mode((400,400)) | |
screen.fill((0,0,0)) | |
pygame.display.flip() | |
white = (255,255,255) | |
def bresenham(x1,y1,x2,y2): |
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 sys,pygame | |
from pygame import gfxdraw | |
pygame.init() | |
screen = pygame.display.set_mode((400,400)) | |
screen.fill((0,0,0)) | |
pygame.display.flip() | |
white=(255,255,255) |
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
# Mid-point circle drawing algorithm. | |
# Requires pygame: http://pygame.org | |
from pygame import gfxdraw | |
import sys,pygame | |
pygame.init() | |
screen = pygame.display.set_mode((400,400)) | |
screen.fill((0,0,0)) | |
pygame.display.flip() |
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 urllib2 | |
import tarfile | |
import os | |
url = 'http://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.1.3.tar.gz' | |
file_name = url.split('/')[-1] | |
u = urllib2.urlopen(url) | |
f = open(file_name, 'wb') | |
meta = u.info() | |
file_size = int(meta.getheaders("Content-Length")[0]) |
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
// Bresenham's line drawing algorithm ( for m <= 1 ) | |
#include <iostream> | |
using namespace std; | |
int drawBH(int x1,int y1,int x2,int y2) | |
{ | |
int x = x1, y = y1; | |
int dx = x2-x1; | |
int dy = y2-y1; | |
int e = 2*dy - dx; |
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 ROUND(a): | |
return int(a + 0.5) | |
def drawDDA(x1,y1,x2,y2): | |
x,y = x1,y1 | |
length = abs((x2-x1) if abs(x2-x1) > abs(y2-y1) else (y2-y1)) | |
dx = (x2-x1)/float(length) | |
dy = (y2-y1)/float(length) | |
print 'x = %s, y = %s' % (((ROUND(x),ROUND(y)))) | |
for i in range(length): |
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> | |
#define ROUND(a) ((int)(a + 0.5)) | |
using namespace std; | |
int drawDDA(int x1,int y1,int x2,int y2) | |
{ | |
float x = x1, y = y1; | |
int len = (x2-x1)>(y2-y1)?(x2-x1):(y2-y1); | |
float dx = (x2-x1)/(float)len; |
NewerOlder