Number of times each package was installed + upgraded in Arch Linux

I’ve made a Python script that (for now at least) plots the number of times each package on my system was installed + upgraded. That is, if the y-axis reads “2”, it means the package was installed and upgraded once. If the y-axis reads “1” it means the package was installed once and never upgraded.

As my system is rather new (about 2 months old), most packages were not upgraded. The package that was most upgraded was Linux (10 times), followed by youtube-dl and python-setuptools. I decided to only show the name of these 3 packages as they were the most upgraded and the x-axis would contain 531 package’s names if I were to show them all.

I seek to post the code soon on github so you can use it and modify it as you wish.

 

Advertisements

A very simple FICS bot in Python

Below is a Python code for a very simple bot that logs in into FICS, ask for a username and password that one must manually enter and then the bot will chat in channel 53, a channel for general discussion where guests can participate.

The code assume that you have a file called “random-words.txt” in /path-to/ directory. You can edit those according to your needs. The bot will randomly pick lines in the text file and send them in the 53th channel. It will do so at a rate of 1 line every 30 seconds by default, but this is adjustable.

Have fun editing and using this bot!


import getpass
import sys
import telnetlib
import string
import time
import random

HOST = "freechess.org"
# user = raw_input("Enter your user name account: ")
user = input("Enter your user name account: ")
password = input("Enter your password: ")
user_bytes = user.encode('utf-8')
password_bytes = password.encode('utf-8')

tn = telnetlib.Telnet(HOST)

tn.read_until(b"login: ")
tn.write(user_bytes + b"\n")
tn.write(password_bytes + b"\n")
tn.read_until(b":")
tn.write(b"\n")
tn.write(b"set tell 1\n")
tn.write(b"set pin 1\n")
tn.write(b"tell 53 Hello, I am a robot!\n")

word_file = "/path-to/random-words.txt"
WORDS = open(word_file).read().splitlines()

while 1:
    word = random.choice(WORDS)
    word_bytes = word.encode('utf-8')
    tn.write(b"t 53 " + word_bytes + b"\n")
    time.sleep(30)