Skip to content

Instantly share code, notes, and snippets.

@hackerdem
hackerdem / bingo_board_gui
Created April 22, 2016 15:14
bingo board with gui, simpl python programming example including tkinter
import random
from tkinter import *
chosen_number_list=[]
numbers=[]
for i in range(1,101):
numbers.append(i)
def random_number_selection():
global c
c=[]
@hackerdem
hackerdem / mysql_1
Last active May 1, 2016 05:01
Mysql database connection with python, creating new table, inserting new data, fetching existing records
import mysql.connector
from mysql.connector import errorcode
import re
from prettytable import PrettyTable
def new_record():
s=""
a=""
b=""
print("Please enter the table name")
@hackerdem
hackerdem / file_searcher
Created May 1, 2016 09:07
python script with a GUI to search a keyword in files
from tkinter import *
import os
from tkinter.filedialog import askdirectory
from tkinter import messagebox
import subprocess
def content_analyser(pat):
with open(pat,'r') as f:
try:
for line in f:
if search in line:
@hackerdem
hackerdem / count_stars
Created May 4, 2016 19:53
Count stars on a photo using python
import numpy as np
import pylab
import mahotas as mh
from skimage import measure
sky=mh.imread('sky.jpeg')
pylab.imshow(sky)
t=mh.thresholding.otsu(sky.astype('uint8'))
labeled,stars=mh.label(sky>t)
print stars
pylab.imshow(labeled)
@hackerdem
hackerdem / bankaccount
Created May 6, 2016 05:53
You are required to develop the BankAccount structure, and develop sub- functions will be called by the provided main program to track transactions of a bank account using the BankAccount structure. The solution should have the following features: - Declares three structures for Customer, Transaction and Account information; - Implements functio…
*******************************************************************************
/*account header file*/
*******************************************************************************
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <iostream>
#include <iomanip>
#include <string>
#include "transaction.h"
@hackerdem
hackerdem / wiki_links
Created May 7, 2016 06:31
extract wikipedia links and record them in a database table using python programming language
@hackerdem
hackerdem / check_link.py
Last active January 5, 2023 18:22
A simple python script to check broken links of a wesite
@hackerdem
hackerdem / hangman_game
Created May 12, 2016 07:36
simple hangman game in python programming language
import random,time,os,hangman_pic
def exit_question():
answer=input("do you wanna play again.Y/N:")
if answer.upper()=="N":
print("See you later bro")
time.sleep(2)
exit()
else:
game()
@hackerdem
hackerdem / progress.py
Created May 13, 2016 15:03
simple progress bar example
import time,sys
def progbar(increment,num):
if increment==num:
print(" Completed")
pass
else:
for i in range(1,10):
if increment==int(num/10):
@hackerdem
hackerdem / tcp_client.py
Created May 13, 2016 15:16
tcp client application in python
import socket
import sys
import argparse
host='localhost'
def echo_client(port):
sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server_address=(host,port)
print("connection to {} port {}".format(host,port))
sock.connect(server_address)