The State of this Blog

Posted on October 01, 2023 in Uncategorized • Tagged with Update, News • 1 min read

An update regarding the state of this blog


Continue reading

Beautiful, beautiful python

Posted on July 11, 2014 in Uncategorized • Tagged with Uncategorized • 1 min read

Hey

After a day of programming I went home to program a little bit, trying to find a way to implement some tests for my GoogleScraper project, which lacked focus for a long time. I needed to have some test data, in my case some words to search for with the above mentioned scraper, and once more I realized how powerful Python (or any programming language) is. This silly little code comes in handy, if you need some random words for some testing purposes:

import requests
import re

def random_words(n=50, wordlength=range(10, 15)):
   """Read a random english wiki article and extract some words.

   Arguments:
   n -- The number of words to return. Returns all found ones, if n is more than we were able to found.
   KeywordArguments:
   wordlength -- A range that forces the words to have a specific length.
   """
   valid_words = re.compile(r'[a-zA-Z]{{{},{}}}'.format(wordlength.start, wordlength.stop))
   found = list(set(valid_words.findall(requests.get('http://en.wikipedia.org/wiki/Special:Random').text)))
   try:
       return found[:n]
   except IndexError:
       return found

print(random_words(200, range(5, 6)))
print(random_words(77, range(16, 26))

Lichess.org chess bot!

Posted on April 23, 2014 in Uncategorized • Tagged with Uncategorized, Programming, Chess • 4 min read

22.05.2014: Updated the bot, should work better now

Hi everyone!

I was in a coding mood during Easter and decided to write a small chess bot with selenium and stockfish engine to cheat a bit on lichess.org.

I think the code is pretty self explanatory and I won't discuss it in depth here. You can tweak the config, the comments should explain what the parameters do.

The config is in the beginning of the code, so modify it there. You should maybe modify it to use your username and password. Make sure that you download stockfish and install it. Then supply the correct path in the 'stockfish_binary' parameter.

As always: Have fun!

Some open issues:

  • Sometimes the last move fails because the bot won't to start a new game before it can checkmate
  • Promoting doesn't work yet :/

Here is the code:

__author__ = 'nikolai'
__date__ = 'Easter 2014'

config = {
    'username' : 'probably_a_spider', # the login username
    'password' : 'somepwd', # the login password
    'stockfish_binary' : '/home/nikolai/PycharmProjects/LichessBot/stockfish-dd-src/src/stockfish', # the path to your local stockfish binary
    #Set to true if the bot should play forever
    'pwn_forever' : True, # if the bot should play endlessly
    'min_per_side …

Continue reading

Success

Posted on July 23, 2012 in Uncategorized • Tagged with Uncategorized • 4 min read

Have you ever wanted to know some strategies and hints how to be more successful in your daily work?

Well, here, i'll compile a list of thoughts and scenarios of effective working, which worked for me or seems to be at least reasonable in my future working career.

To illustrate and give an example for every wisdom, we use the example for a job assignment I could found myself in: The fictional job requires the accomplishment of a security audit of the employers content management system written in PHP. We have access to all sources, although the project is proprietary and is under a restrictive license.

1. Develop broad general knowledge.

The curios reader would ask now, why the hell do we need a proper general knowledge to scan a web application for programming errors which might weaken its security? Well, before you begin reading every line of code and do the formal, rather static part of your work, you'd better square the context of your task with your general knowledge: Where do the people, who wrote the application live at? Which language do the speak? What does the company which runs the cms exactly offer?

2. Work at least …


Continue reading