Skip to content

Instantly share code, notes, and snippets.

View shdwkl's full-sized avatar

shdwkl

  • 我的鸡巴
View GitHub Profile
@shdwkl
shdwkl / hn_api.py
Created April 19, 2021 17:37
hackernews API get top 30 articles every day.
import requests
from operator import itemgetter
# Make an API call, and store the response.
url = 'https://hacker-news.firebaseio.com/v0/topstories.json'
r = requests.get(url)
print("Status code:", r.status_code)
@shdwkl
shdwkl / main.py
Created April 21, 2021 21:20
Numerous ways to extract text from pdf and more (ORC)
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams, LTFigure, LTTextBox
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager
from pdfminer.pdfpage import PDFPage, PDFTextExtractionNotAllowed
from pdfminer.pdfparser import PDFParser
from pprint import pprint
text = ""
stack = ""
@shdwkl
shdwkl / github-desktop-ubuntu
Created April 23, 2021 18:44
github-desktop-ubuntu.sh
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.6.3-linux1/GitHubDesktop-linux-2.6.3-linux1.deb
#then in the packaeg folder run package manager installation.
sudo dpkg -i GitHubDesktop-linux-2.6.3-linux1.deb
@shdwkl
shdwkl / geometry.cpp
Created June 16, 2021 17:42
university project in cpp
#include <iostream>
#include <string>
#define PI 3.1415926
using namespace std;
///////////////////------------------Variables---------------/////////////////////////
@shdwkl
shdwkl / Gwall.py
Last active December 8, 2021 00:28
#!/usr/bin/python3
import glob
import os
from random import randint
from time import sleep
# Time interval in hours
hours = 1 / 60
@shdwkl
shdwkl / main.py
Created September 10, 2021 01:24
Conver and <FILE>.rst into <FILE>.md
import os
import click
@click.command()
@click.option('--file', '-f', help='RST file to convert into Markdown. ')
def file_convert(file):
click.echo(f'Converting {file}....')
click.echo(f"Check Your dirictory for {str(file).replace('rst','md')}")
os.mkdir('created')
@shdwkl
shdwkl / sheet.py
Created September 10, 2021 22:54
Python sheet cheet
# Single line comments start with a number symbol.
""" Multiline strings can be written
using three "s, and are often used
as documentation.
"""
####################################################
## 1. Primitive Datatypes and Operators
####################################################
@shdwkl
shdwkl / collatz-conj.py
Created September 11, 2021 16:14
Find the number of steps it takes to reach one using the Collatz conjecture
'''
author: yusufadell
Name: collatz-conj.py
Purpose: Find the number of steps it takes to reach one using the following process:
If n is even, divide it by 2. If n is odd, multiply it by 3 and add 1.
Author: Yusuf Adel (y8l)
Algorithm: Collatz conjecture
License: MIT
{
"theme": "serika_dark",
"customTheme": false,
"customThemeColors": [
"#323437",
"#e2b714",
"#e2b714",
"#646669",
"#d1d0c5",
"#ca4754",
@shdwkl
shdwkl / threading.py
Created November 6, 2021 14:10
Threading is a technique for decoupling tasks which are not sequentially dependent. Threads can be used to improve the responsiveness of applications that accept user input while other tasks run in the background. A related use case is running I/O in parallel with computations in another thread. The following code shows how the high level thread…
import threading, zipfile
class AsyncZip(threading.Thread):
def __init__(self, infile, outfile):
threading.Thread.__init__(self)
self.infile = infile
self.outfile = outfile
def run(self):