Coding

Wallpaper Automation Tool: WPCTL

Hey,

Today I will come up with a very minimalistic wallpaper automation tool WPCTL. I spend most of my time on the computer. There are not too many options to have fun with while working on the computer. Interesting and colorful photos are one of the favorite entertainment sources for my daily routine. Therefore, I really like auto wallpaper changer programs which surprises me with different photos. I decided to use one of these programs. However, none of them is fulfiled my requirements. I want a wallpaper changer which should be like:

Rambling On Randomness

What is randomness

According to the Oxford Dictionary, “the randomness is the apparent lack of pattern or predictability in events”. Randomness implies “Unpredictability”. To practically illustrated it: if a sequence of numbers is given and you have no way to predict what the next number in the sequence will be - then the sequence is random. A single number cannot ever be random. 13…ok…not random. But: 1, 3, 5, 7, 9, 11, 13 …the ‘13’ doesn’t seem very random because you could have predicted it with almost complete certainty.

Harmonica Note Converter

Harmonica Note Converter aims to create a python library to convert notes or tabs for different kind of harmonicas. It is based on musthe.

https://github.com/mozanunal/harmonica-note-converter

Story

Some of you know that I am an ameteur harmonica player and I love harmonicas. I usually play diatonic harmonicas but last time I have bought a chromatic harmonica, which has quite different tone and it is hard to find music notes for it.

I am not the best at playing instruments. However, I am good at coding and music theory. That’s why I decide to develop a tool to convert music notes for any instrument to notes for my harmonicas. I also create an modular structure to define new instruments.

Hash Code 2020

Hello Everyone,

I want to share our solution for Google Hash Code 2020. It is the code repo of team titanium-white for Google Hash Code 2020 Online Qualification Round. We have writen our code in Python.

Code can be reached from here

Code

Basically, the problem class is the backbone of the system.

  • It handles the inputs and outputs with functions __init__ and dump.
  • It read the input files and creates objects according to that. I think the one of the thing we did well is this __init__ function. It create all the objects like books, libraries even if book2score dictionary.
  • It also handles the solving opeartion. It iterate trough the days and get max predicted score from every library available. When the libraries calculating the max pred scores, they get the current state as input. Therefore their predictionsa are more accurate. After the library is selected the state is updated such as day, already scanned books and state of the selected library.
# main.py
from library import Library, Book
import numpy as np

class Problem(object):
    def __init__(self, filename):
        print('file--', filename)
        f = open(filename)
        l = f.readline().split(' ')
        self.filename = filename
        self.nBooks, self.nLibs, self.nDays = int(l[0]), int(l[1]), int(l[2])
        self.books = [ Book(i,int(score)) for i, score in enumerate(f.readline().split(' '))]
        sumb = 0
        for b in self.books:
            sumb += b.score
        print( sumb/1000000 )
        self.book2Score = {book.id: int(book.score) for book in self.books}
        self.libs = []
        for libId in range(self.nLibs):
            l = [int(i) for i in f.readline().split(' ')]
            nBooks, nSign, nScan = l[0], l[1], l[2]
            books = [ Book(int(i), int(self.book2Score[int(i)])) for i in f.readline().split(' ') ] 
            lib = Library(libId, nBooks, nSign, nScan, books)
            self.libs.append(lib) 
        self.pri()

    def solve(self):
        t = 0
        solution = []
        readBookSet  = set()
        while t < self.nDays:
            print('-----', t)
            scoreList = []
            readBookList = []
            for lib in self.libs:
                if lib.registered == False:
                    score, curBookList = lib.predMaxScore(self.nDays - t, readBookSet)
                    scoreList.append( score )
                    readBookList.append( curBookList )
                else:
                    scoreList.append(0)
                    readBookList.append( [ ] )
            if len(scoreList) == 0:
                break
            if max(scoreList) == 0:
                break
            libIndex = scoreList.index(max(scoreList))
            self.libs[libIndex].registeredDay = t
            self.libs[libIndex].registered = True
            self.libs[libIndex].solBooks = readBookList[libIndex]
            readBookSet = readBookSet.union(readBookList[libIndex])
            solution.append(self.libs[libIndex])
            t += self.libs[libIndex].nSign
        print([(lib.id, lib.nSign, lib.registeredDay) for lib in solution])
        return solution

    def dump(self, solution):
        f = open(self.filename.replace('data/', 'out/'), 'w+')
        f.write('{}\n'.format(len(solution)))
        for lib in solution:
            books = lib.solBooks
            f.write('{} {}\n'.format(
                lib.id, len(books)
            ))
            s = ""
            for book in books:
                s+= str(book) + ' '
            s+='\n'
            f.write(s)
        f.close()



    def pri(self):
        print('------')
        print(self.nBooks, self.nLibs, self.nDays)
        #print(self.libs)
        print('------')


if __name__ == "__main__":
    p = Problem('data/a.txt')
    solution = p.solve()
    p.dump(solution)

The Second critical class is Library class. The vital function in our implementation is predMaxScore. We are doing calculating this with total book score / (sign day*sign day). Because, during our experiments, we saw that the sign days length is quite important especially for some datasets. Total book score is simply if in that day the library is chosen, how much of the books can be scanned until the end of total days. Of course these books are selecting according to their scores and they should be not scanned before.

Coolest C Trick

Hello Everyone,

Just a quick post here…

Today I have seen a code snippet which makes me quite happy.

#include <stdio.h>
int main()
{
    int x = 10;
    while (x --> 0) // x goes to 0
    {
        printf("%d ", x);
    }
}

The the output of this is:

9 8 7 6 5 4 3 2 1 0

It was a little suprising for me at first sight. I thought that what the hell is --> operator. After then I understand that it is actually x-- and >. X compared with 0 (cheked if it is bigger than 0) and then it is decremented by 1. Therefore, this loop can be decoded to this:

Show Images Directly on Terminal: img2sh

Img2sh

Hello there,

In this post, I want to tell a brief story of how I have created a tool named img2sh. It is also my first python package which is published over PyPI. In this very post, I will try to answer questions like: How is it developed? What are the challenges? How should a package created and deployed over PyPI? Let’s continue!

Img2sh is a tool to show images directly on the terminal. For colored images, 256 xterm color support is required. This script basically resizes the image with anti-aliasing and quantized its colors to xterm color pallette. Github repository of the project can be reached from here

Yolo on Google Colab

Run YOLO V3 on Colab for images/videos

Hello there, Today, we will be discussing how we can use the Darknet project on Google Colab platform. For those who are not familiar with these terms:

YOLO in action!

  • The Darknet project is an open-source project written in C, which is a framework to develop deep neural networks.
  • Yolo V3 is an object detection algorithm. It is one of the state of the art solution when accuracy/processing power needed metric is considered.
  • Google Cola is a cloud-based data science workspace similar to the jupyter notebook. Each Collabrotary session is equipped with a virtual machine running 13 GB of ram and either a CPU, GPU, or TPU processor. In most case, all the required packages are already installed on these machines and you can quite easily start development using Google Collaboratory. It saves us from installing process and it provides us easy to accessible GPU’s which is also free under some constraints.

Have a look Ted Talk by Joseph Redmon the developer of the darknet project. The talk is about Darknet and YOLO projects which titled as “How computers learn to recognize objects instantly” . Darknet project aims to create a new neural network framework which is completely focused on simplicity and performance. The thing which I like about is its clarity and performance. All the code is written in C, to define a deep learning network you should only create a config file which defines the layers. By this way, it does not lose its performance capabilities also it provides us easy to use interface for development with this library.

Playing DOTA on Raspberry Pi using Steam Link

Hello, Steam Link is software which provides support to Steam to stream screen view of the games to devices which is on same local area network. In this setup, there are 2 devices. First one is the device to run the Steam and the games which act as a server. The second one is the one which runs Steam Link and acts as a client to this server. By using this technology you can play games directly on a device which is connected to the same router. The connection is also 2 way. Thus, control devices such as keyboard, mouse and game controllers can be connected directly to the client device.

[TR] Android Terminal Emülatörü: Termux

Herkese Merhabalar,

Benim gibi sıklıkla linuxla uğraşan bir insansanız işinize çok fazla yarıyabilecek bir araçtan bahsedeceğim. Bu Androidte çalışan terminal emülatörü Termux. Termux linux kullanmaya alışık olduğumuz araçları androidde de kullanabilmemizi sağlayan bir android app aslında. Direk play store üzerinden bu link üzerinden yükleyebilirsiniz. Termux aynı zamanda açık kaynaklı bir proje github hesabına buradan ulaşabilirsiniz. Burada android app ve bütün paketlerin kaynak kodu mevcut.

termux ssh bağlantısı

Özelliklerine gelecek olursak kendi paket yöneticilerini geliştirmişler. İsmi pkg bir sürü popüler paketi kurabilmeniz mümkün. Programa girdiğinizde direk bir bash terminal karşılıyor bizi. Burada standart bash komutlarının çoğu çalışıyor. Örneğin ls, pwd, cat, echo…

[TR] Hackhathon Getir 2018

It is a project developed for BiTaksi Getir Hackathon 2018. Detailed information can be found from below.

Team Paketci!

Check our app from here which is deployed using heroku.

Check github repo of app from here

Timeline of our little project!

Getir Hackhathon 2018 Team Members: Sertan Sezgin Kutlu Ertuğrul Çınar Mehmet Ozan Ünal

Paketci App

Its a work on pack collection and delivery for courier and observer.

Features:

By Backend: 1.Assign routes for couries by relate most efficent path. 2.Update states of packets. 3.Update states of couriers.

1 2 3 Next →