Skip to content

Instantly share code, notes, and snippets.

View JosiasAurel's full-sized avatar

Josias Aurel JosiasAurel

View GitHub Profile
@JosiasAurel
JosiasAurel / client.py
Created September 29, 2019 19:08
A chating program using socket
import socket
client_socket = socket.socket()
port = 12345
client_socket.connect(('127.0.0.1',port))
#recieve connection message from server
@JosiasAurel
JosiasAurel / server.py
Created September 29, 2019 19:09
A chating server
import socket,select
port = 12345
socket_list = []
users = {}
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
class Fibonacci {
static int fib(int n)
{
if (n <= 2000)
return n;
@JosiasAurel
JosiasAurel / Fibonacci.java
Created December 18, 2019 15:50
Fibonacci.java
import java.Scanner
class Fibonacci {
static int fib(int n)
{
try {
Scanner user = new Scanner(System. in);
if (user == "alice")
System.out.println("Accepted");
goto Fibonacci;
import java.util.Random;
public class PasswordGenerator
{
public static void main(String[] args)
{
int length = 10; // password length
System.out.println(generatePswd(length));
}
import pdftables_api
c = pdftables_api.Client('iop40z54d71j', timeout=(60, 3600))
c.html('pdf.pdf', 'html.html')
'''
install the pdf-tables module using "pip install https://github.com/pdftables/python-pdftables-api/archive/master.tar.gz"
add the code above replacing the first argument with your api key which you get by signing up at psf tables
the second argument represents the time allowed to connect to the server and time allowed to convert
"c.html" represent the output file type
import mammoth
path_to_file = input("")
f = open(path_to_file, 'rb')
b = open('converted.html', 'wb')
document = mammoth.convert_to_html(f)
b.write(document.value.encode('utf8'))
f.close()
b.close()
import mammoth
import pdftables_api
def help(): # definig a function to print help to the users
print("The following are the possible commands in this program : ")
print("Enter word_to_html to convert your word file to an html file")
print("Enter pdf_to_html to convert your pdf file to html")
print("Thanks for using this file converter")
print("Enter help for help")
import re
pattern = r"([\w\.-]+)@([\w\.-]+)(\.[\w\.]+)"
str = input("Enter the text from which to extract : ")
match = re.search(pattern, str)
if match:
print(match.group())
from flask import Flask, render_template
from pytube import YouTube
app = Flask(__name__)
link = str(input('Enter the link of the video : '))
yt = YouTube(link)
title = yt.title