Skip to content

Instantly share code, notes, and snippets.

View noveoko's full-sized avatar
🏠
Working from home

Marcin Kraszewski noveoko

🏠
Working from home
View GitHub Profile
import random
from random import shuffle
comics = ['Ricky','Ashley','Kamil','Daniel','Trevor','Tomek']
special_request = 'Christine'
def shufflez(list):
long_list = []
total = 0
while total < 1000:
long_list.append(random.choice(comics))
#Solution to Problem 1:
k = [[a for a in range(0,100) if a % 2 == 0]]
#Solution to Problem 2:
def generate_list():
k = []
for a in range(0,101):
k.append(list(range(0,101)))
return k
@noveoko
noveoko / bank_account.py
Created February 25, 2017 16:27
A class that manages a financial account
class account:
def __init__(self, owner, balance):
self.owner = owner
self.balance = balance
def changeCountry(self, newCountry):
self.owner['country'] = newCountry
def clientReport(self):
print('START CR')
@noveoko
noveoko / secret_number.py
Last active March 19, 2017 00:11
Someone posted a puzzle on the internet
#I wrote a script to extract +1,000 answers to this question.
#The results I came up with regarding the frequency of answers is:
#Counter({'6': 761, '3': 400, '9': 341, '-3': 100, '7': 100})
from bs4 import BeautifulSoup
import re
import collections
pattern = '([\-]*\d+)'
def extract_data_from_report3(filename):
from textblob import TextBlob
import requests
from bs4 import BeautifulSoup as bs
url = 'https://en.wikipedia.org/wiki/Human'
topic = url.split('/')[-1]
text = requests.get(url)
text = text.content
soup = bs(text, 'lxml')
text = soup.find_all('p')
@noveoko
noveoko / bibliography.txt
Created September 20, 2017 20:40
The output generated by a few lines of Python using a PDF as source
/usr/bin/python2.7 /home/mkraszewski/PycharmProjects/pdfreader/scrapepdf.py
* /usr/bin/pdftotext -raw -q -enc UTF-8 my.pdf -
* convert_PDF_to_plaintext found: 5094 lines of text
* title u'Bibliography\n'
* marker u'1.'
* title_marker_same_line False
* references separator \s*(?P<mark>(?P<marknum>\d+)\s*\.(?!\d))
* tags u'<cds.AUTHstnd>ALLPORT, G. W.</cds.AUTHstnd> <cds.QUOTED>The General and the Unique in Psychological Science</cds.QUOTED>, Journal of Personality, XXX (1962), 405-422.'
* Searching for book title in:
* Book not found!
(0, {'author': [u'ALLPORT, G. W.'], 'title': [u'The General and the Unique in Psychological Science'], 'misc': [u'Journal of Personality, XXX , 405-422'], 'year': [u'1962'], 'linemarker': [u'1'], 'raw_ref': [u'1. ALLPORT, G. W. "The General and the Unique in Psychological Science\u201d, Journal of Personality, XXX (1962), 405-422.']})
(1, {'linemarker': [u'2'], 'raw_ref': [u'2. ALLPORT, G. W., Ed. Letters From Jenny. New York: Harcourt, Brace & World, 1965.'], 'misc': [u'Letters From Jenny. New York: Harcourt, Brace & World'], 'author': [u'ALLPORT, G. W., Ed.'], 'year': [u'1965']})
(2, {'linemarker': [u'3'], 'raw_ref': [u'3. Anonymous. Journal of Humanistic Psychology, I (1961), 101-102.'], 'misc': [u'Anonymous. Journal of Humanistic', u'101-102'], 'author': [u'Psychology, I'], 'year': [u'1961']})
(3, {'author': [u'ASCH, S.'], 'title': [u'Studies of Independence and Conformity, Part I'], 'misc': [u'Psychological Monographs, LXX . (Whole No.416.)'], 'year': [u'1956'], 'linemarker': [u'4'], 'raw_ref': [u'4. ASC
Raw Citations Bulk Extracted from the PDF:
'SIU, R. G. H. The Tao of Science. New York: Wiley, 1957.'
'SOROKIN, P. Fads & Foibles in Modern Sociology and Related Sciences. Chicago: Regnery, 1956.'
'STANDEN, A. Science Is a Sacred Cow. New York: Dutton, 1950.'
'TOLMAN, E. C. Purposive Behavior in Animals and Men. New York: Century, 1932.'
'TORRANCE, E. P. Guiding Creative Talent. Englewood Cliffs,N.J.: Prentice-Hall, 1962.'
Parse Citations from the Raw Citations:
<author>'SIU, R. G. H.</author>
<title>The Tao of Science.</title>
http://tomtunguz.com/advice-frameworks/
http://tomtunguz.com/customer-pull/
http://tomtunguz.com/sales-marketing-spend-model/
http://tomtunguz.com/theory-data-sales-commission-plans/
http://tomtunguz.com/hiring-for-unfamiliar-discipline/
http://tomtunguz.com/commodification-of-saas/
http://tomtunguz.com/cash-conversion-cycle/
http://tomtunguz.com/bootstrapped-when-to-raise/
http://tomtunguz.com/self-service-data/
http://tomtunguz.com/what-is-strategy/