Skip to content

Instantly share code, notes, and snippets.

View codeboy101's full-sized avatar

Tushar codeboy101

View GitHub Profile
## two different files pasted under one gist
# server .py
import socket
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # using address family ipv4 and protocol tcp/ip
sock.bind(('0.0.0.0',8881)) # host , port number
sock.listen(5)
s,data=sock.accept() # accept socket connections
client_mail = b'<client>: '
while True: #keep on sending and receiving data
import math
def answer(x):
x = 1235
if x >= 1:
i = 0
t = 0
while x.len > 1:
if i < x.len:
myVar = int(x)
l = math.pow(10, math.floor(math.log(myVar) / math.log(10)) - i)
ask_user = input("word: ")
if 'tv' or 'television' and 'off' in ask_user:
print("thats nice , my dog ate mine")
elif 'tv' and 'volume' in ask_user:
print("the dog ate my volume")
else :
print("i never had a dog")
# importing required stuff
import pygame,sys
from pygame.locals import *
import random
pygame.init() #initialize pygame
# initializing surface,readying bird image, loading background image,setting caption , initializing Sound , setting font
display_surface = pygame.display.set_mode((640,480)) # set the surface of the display
display_surface_rect = display_surface.get_rect()
import urllib.request , urllib.parse , re
#x = urllib.request.urlopen("https://www.google.com")
#print(x.read())
url = "http://pythonprogramming.net"
values = {"s":"basic","submit":"search"}
data = urllib.parse.urlencode(values) # important to encode values, will get encoded in the format in which they are legitimate to be used in urlbar
data = data.encode("utf-8")
req = urllib.request.Request(url,data)
response = urllib.request.urlopen(req)
message = 'GUVF VF ZL FRPERG ZRFFNTR.'
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for try_number in range(len(LETTERS)):
decoded_message = ''
for character in message:
if character in LETTERS:
location_of_character = LETTERS.find(character)
location_of_character = location_of_character - try_number
if location_of_character < 0:
location_of_character = location_of_character + len(LETTERS)
even_list = ['0','2','4','6','8']
ask_user = input("enter number: ")
x = len(ask_user) - 1
if ask_user[x] in even_list:
print("the number is EVEN")
else:
print("the number you have entered is odd")
using System;
namespace thisspace
{
class newclass
{
public static void Main(string[] args)
{
int x = 24;
int y = x;
from random import randint
myscore = 0
oppscore = 0
play = 0
roundplay = 1
while play < 10:
question = input("Do you want to play? ")
if question == "no":
print ("175 for allout")
elif question == "yes":
@codeboy101
codeboy101 / c.c
Last active February 18, 2016 15:40
#include <stdio.h>
#include <stdlib.h>
int main(){
char name [100];
int x = 5;
printf("enter your name: ");
fgets(name,100,stdin);
if (name == "jamie"){
x = 7;