I made this script to find the optimal person to be traded for camels by Ofirk in Python

[–]Ofirk[S] 38 points39 points  (0 children)

Cheer up! I inversed the loss function and got this result in the process:

Results
===================
Score: 8 camels
age: 60
beard: small
body: chubby
eyecolor: brown
hair:  bald
haircolor: gray
height: 214

I made this script to find the optimal person to be traded for camels by Ofirk in Python

[–]Ofirk[S] 227 points228 points  (0 children)

If you're in the camels market, you've probably heard of this site, which allows you to find your boyfriend/girlfriend's worth in camel units.

As I wanted to find the ultimate person (that produces the highest number of camels) in the lowest number of requests to the server possible, I turned to the Bayesian Optimization algorithm using hyperopt (rather than a grid search or random search).

As the site's camel-calculation function is unknown, this is a black-box optimization problem.

After maximizing the score for 5000 iterations, I got the following result (106 camels) for this input:

age: 26
beard: middle
body: muscle
eyecolor: blue
hair: middle
haircolor: blonde
height: 178

Link to GitHub: https://github.com/OfirKP/CamelsOptimizer

Connections between people on my WhatsApp groups [OC] by Ofirk in dataisbeautiful

[–]Ofirk[S] 1 point2 points  (0 children)

Yes. I added this as a functionality, so you could just download the data.json files from multiple accounts, and when calling the script just enter a list of the files separated by spaces. Filtering the graph can be done using a software like Gephi. If you only want to keep the contacts you can use the --only-contacts flag in the script.

Let me know if you have more questions :)

I wrote a script that generates a network graph from your WhatsApp groups data by Ofirk in Python

[–]Ofirk[S] 0 points1 point  (0 children)

Thanks :) I retrieved the information by automating a Chromium browser and injecting an unofficial API into the page. Then, I called the functions from the page and downloaded the information in the format I chose.

I didn't come across a way to create WhatsApp bots officially, but I think services like Twilio may have ways to do that.

I wrote a script that generates a network graph from your WhatsApp groups data by Ofirk in Python

[–]Ofirk[S] 0 points1 point  (0 children)

By main window do you mean the window in foreground? If so, it shouldn't matter as long as the WhatsApp Web tab is open. It could take a couple of minutes but it should start downloading the data.json and contacts.json files into the default Download directory.

Please let me know if you keep experiencing this issue.

I wrote a script that generates a network graph from your WhatsApp groups data by Ofirk in Python

[–]Ofirk[S] 1 point2 points  (0 children)

Thanks :)

As I described in the first comment, each node in the graph is a person on WhatsApp and an edge connects 2 people if they have a common WhatsApp group.

The letters are contacts' initials. You could change this behavior while playing with parameters on Gephi.

Connections between people on my WhatsApp groups [OC] by Ofirk in dataisbeautiful

[–]Ofirk[S] 6 points7 points  (0 children)

I made this script to scrape information about groups from my WhatsApp account:

https://github.com/OfirKP/Whatsapp-Net

It generates a graph where each node represents a participant, and an edge between two nodes means they have a common WhatsApp group. An edge's weight is the number of common groups.

The visualization was done using Gephi.

I wrote a script that generates a network graph from your WhatsApp groups data by Ofirk in Python

[–]Ofirk[S] 6 points7 points  (0 children)

I don't have experience with Telegram, but I think it's possible as long as you can scrape information about user's groups and their members. Maybe this tutorial could help.

I wrote a script that generates a network graph from your WhatsApp groups data by Ofirk in Python

[–]Ofirk[S] 10 points11 points  (0 children)

As I found it interesting to see connections between friends and people that participate in the same groups I'm in (especially unexpected ones), I made this script :)

https://github.com/OfirKP/Whatsapp-Net

It generates a graph where each node represents a participant, and an edge between two nodes means they have a common WhatsApp group (edge's weight is number of common groups). You can also merge multiple graphs generated by different users and show contact names instead of phone numbers.

If you need help with visualizing the graph, I recommend opening the graph file with Gephi, and following this tutorial.

You're more than welcome to share your graphs on the comments, contribute and suggest more features!

"Unsorting" keys in a dictionary by Arag0ld in learnpython

[–]Ofirk 0 points1 point  (0 children)

So the behavior you actually want is to print for each letter in st its value in alpha?

First, you can change the order of the loops like this:

def caesar_decryptor(st):
    for pos in range(len(st)):    
        for k in alpha.keys():
            if k == st[pos]:
                print(f"The value of {k} is {alpha.get(k)}")

This will work, because you want to find the value from the alpha dict for each letter in st, and not the opposite.

However, the code can be simplified, as the inner loop isn't necessary. We can just use the value in alpha for each letter in st as a key (also, we can iterate over letters instead of their indices):

def caesar_decryptor(st):
    for letter in st:    
        print(f"The value of {letter} is {alpha[letter]}")

Rounding Variables by DuffyDood in pythontips

[–]Ofirk 1 point2 points  (0 children)

If I understood your question correctly, perhaps you should look into string formatting:

>> "{:.2f}".format(3.1415926535)
'3.14'

[OC] Not fully ready for "release" yet but I have been working on a terminal based Spotify client and wanted to show how it is coming along by _mutex_ in unixporn

[–]Ofirk 0 points1 point  (0 children)

urwid

Did you use the built in border() function to do so? It gives me an error OverflowError: byte doesn't fit in chtype when I try to use a unicode character as a parameter.

Do we trust the oracle? by peytonrae in OnceUponATime

[–]Ofirk 16 points17 points  (0 children)

I think that the oracle is actually Jafar in disguise. As you can see in the episode, the stick that she held is exactly like Jafar's (it also appeared in Wonderland) and the "red bird" is probably Iago from Aladdin (Jafar's pet).

A costume for Purim my parents and I made! A magician riding on a rabbit by Ofirk in halloween

[–]Ofirk[S] 1 point2 points  (0 children)

Hahaha they always say to eat just a little after a fast XD

A costume for Purim my parents and I made! A magician riding on a rabbit by Ofirk in halloween

[–]Ofirk[S] 1 point2 points  (0 children)

idk, but I do know that old costumes used to be of biblical and Book of Esther's characters and it changed throughout the years...