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
#!/usr/bin/python2 | |
class Window(object): | |
def draw(self, device): | |
device.append('flat window') | |
def info(self): | |
pass | |
# The subclass approch | |
class BorderedWindow(Window): |
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
#!/usr/bin/env python2 | |
import pygame | |
from pygame.locals import * | |
COLOR_BG = (0xff, 0xff, 0xff, 0xff) | |
COLOR_BLACK = (0, 0, 0, 0xff) | |
COLOR_TRANS = (0, 0, 0, 0) | |
G = 1 | |
class SMTNode: |
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
from collections import deque | |
import random | |
def gen_graph(n, m): | |
a = [[None] * n for i in range(n)] | |
for i in range(m): | |
x = random.randint(0, n-1) | |
y = random.randint(0, n-1) | |
c = random.randint(1, 100) | |
a[x][y] = c | |
return a |
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.io.*; | |
import java.net.*; | |
import java.util.Scanner; | |
public class MyClient{ | |
Socket clientSocket; | |
OutputStreamWriter out; | |
Scanner in; | |
public void connect(String dest, int port){ | |
try{ |
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.io.*; | |
import java.net.*; | |
import java.util.Scanner; | |
import java.util.NoSuchElementException; | |
public class MyServer{ | |
ServerSocket serverSocket; | |
Socket clientSocket; | |
Scanner in; | |
BufferedWriter out; |
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
#include<iostream> | |
#include<string> | |
#include<cstdio> | |
#include<cstring> | |
#include<cctype> | |
#include<vector> | |
#include<cstring> | |
#include<algorithm> | |
#include<vector> | |
#include<cmath> |
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
#include<iostream> | |
#include<sstream> | |
#include<string> | |
#include<queue> | |
#include<cstdio> | |
#include<cstring> | |
#include<cctype> | |
#include<vector> | |
#include<cstring> | |
#include<algorithm> |
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
#include<iostream> | |
#include<string> | |
#include<cstdio> | |
#include<cstring> | |
#include<cctype> | |
#include<vector> | |
#include<cstring> | |
#include<algorithm> | |
#include<vector> | |
#define For(i, n) for(i = 0; i < n; i++) |
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
""" | |
usage: cutter.py src destPrefix | |
""" | |
import sys, os | |
from time import sleep | |
CHUNK = 8 * 1024 | |
BLOCK = 2 * 1024 ** 3 - 1 | |
src = sys.argv[1] | |
destPrefix = sys.argv[2] |
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
"i'm here" | |
import socket | |
import getpass | |
from time import sleep | |
Port = 8789 | |
User = getpass.getuser() | |
Delta = 3.0 | |
dest = ('<broadcast>' , Port) | |
s = socket.socket(socket.AF_INET , socket.SOCK_DGRAM) |