Enkelt skript för att fånga rssfeed från youtube

källa: https://github.com/amoore17/youtube-rss-finder/blob/master/rss-fetch.py

import urllib.request
import re

to_file = ""
output_file = ""
file_exists = False

while (to_file == ""):
    to_file = input("Would you like to export your RSS feeds to a file? (\"y\" or \"n\"): ")
    if (to_file == "y"):
        to_file = True

        option = ""
        while (option == ""):
            output_file = input("Enter name of the output file: ")

                file_exists = True
                file_exists = False

            if (file_exists == True):
                print("A file of that name already exists")
                print("Would you like to: ")
                print("1. Append to file")
                print("2. Overwrite")
                print("3. Specify different name")
                print("4. Quit")
                option = int(input("Enter a number: "))

                if (option == 1):
                    f = open(output_file, "a+")
                elif (option == 2):
                    f = open(output_file, "w+")
                elif (option == 3):
                    option = ""
                f = open(output_file, "w+")
    elif (to_file == "n"):
        to_file = False
        to_file = ""
        print("Invalid option")

ans = 'y'

while (ans == 'y' or ans == 'Y'):
    url = input("Enter YouTube URL: ")
    req = urllib.request.Request(url)
    resp = urllib.request.urlopen(req)
    respData = resp.read().decode("utf-8")

    # Search for RSS in the HTML
        rss = re.findall(r'channel_id=(.*)"', respData)
        rss = "https://www.youtube.com/feeds/videos.xml?channel_id=" + rss[0]
        if (to_file == True):
            f.write(rss + "\n")
            print("Outputted to \"" + output_file + "\"")
    # Else search for RSS in the channel name
            rss = re.findall(r'/channel/(.*)', url)
            rss = "https://www.youtube.com/feeds/videos.xml?channel_id=" + rss[0]
            if (to_file == True):
                f.write(rss + "\n")
                print("Outputted to \"" + output_file + "\"")
            print("Unable to find RSS")

    ans = input("Would you like to enter another url? ('y' or 'n'): ")


Eget enkelt rollspel

Saxat från ett eget inlägg på social medier:

Min 9åriga son satt och tecknade. När jag sneglade närmare såg jag att det var en dungeon. Med fällor och gångar. Han hade just börjat. När han såg att jag sneglade frågar han om jag ville spela. Självklart satte jag mig ner och han började spelleda mig. Jag fick vapen: ett svärd, ett armborst som skjuter knivar – vilket är bra för närstrid – och en oändlighetssäck. “Ni vet en sådan där som rymmer allt.”

Vi hade bara en T6 men allt eftersom klurade han ut svårighetsgrader för att träffa och uppgifter. Skadan var en enkel T6.

Jag har hittills hittar och dödar två kyklingätande-skelett och tack vare att tärningen visade en etta missade jag en hemlig gång i botten av en kista.

Tillsammans klurade vi ut att man kan få minus på olika färdighetsslag. Ex: Armborstet har en räckvidd på 10m (10 rutor i anteckningsboken) men efter fem meter får jag -1 på min skadetärning.

Detta kommer så klart ändras och diskuteras. MEN vad roligt. Han tänker och klurar. Funderar på vad som är möjligt till skillnad till vad som är roligt osv. Det behövs inte mycket för att spela.


Intressant tabell.

From: https://imaginaryhallways.blogspot.com/2019/12/whiff-table-something-happens-every.html


I’m thinking of running 0e DnD or Black Pudding‘s flavor of B/X, or Moldhammer, or Wolfbreaker. But I love combat systems from Into the Odd where there’s no to-hit roll (and no missing) or Troika/Tunnel Goons/Macchiato Monsters where someone always gets hit. What to do? Write a whiff table!

When two opposed combatants in melee both miss their attacks, roll on the whiff table.

  1. You knock each other’s helms off. If anyone involved is not wearing a helm, they take 1d6 damage.
  2. You both fall down. 50% chance you’re on top. You’re at a range where punches, kicks, and daggers will work; larger melee weapons will not.
  3. You bind weapons and then push one another back. Their weapon lands at your feet; yours lands at theirs.
  4. Belt or backpack cut. Lose the top item in your inventory, as it is on the ground now.
  5. Lesser HD combatant knocked back into someone else on their side, who must save or be knocked down.
  6. Environmental damage! Crack the ceiling, start a fire, destroy furniture, valuables, etc.
  7. Tooth loosened. You can spit it out in their face for a +4 to hit bonus next round, or try to keep it in place and get it fixed later (maybe?). No hp loss.
  8. Metal strikes stone. You and your opponent are bathed in sparks. Exposed paper or oil will begin to burn. Hair smolders.
  9. Opponent had an oil jar or gland that you just barely nick, but it splits open nevertheless. You, your opponent, and the ground are drenched in oil.
  10. You just barely get an opening. If you swing with everything you have, embedding your weapon in your opponent, you can do so and roll damage with advantage, but you lose your weapon. Otherwise, normal miss.
  11. Their swing or thrust misses, but tosses sweat and grit in your eyes. Take -4 to AC until you spend a round wiping that out; your peripheral vision is .
  12. You clash weapons and it’s incredibly loud. Roll for an additional encounter.
  13. You disarm them and their weapon sails behind them. If they have natural weapons they take 1d6 damage.
  14. Their weapon pins you in place. They lose it but you will have to struggle for 1d3 rounds to be able to move again. Can still fight.
  15. Ancient war-sigil mine stepped on, 1-3 by you, 4-6 by enemy. Spend next round levitating 10′ in the air. Spells lowers you down gently (defective).
  16. Skyknife! Your weapon is knocked up into the ceiling and lodged there. It’ll fall in 1d6 rounds. Anyone under it could be hit by it. (If no ceiling is available your weapon targets someone random closeby.)
  17. Ambient magical energy interacts with your intent to cause harm. You and your opponent glow like torches. -4 AC penalty to both of you for 1d6 rounds.
  18. You blink blood out of your eyes. You and your opponent are covered in blood and gore. Perhaps another attack drenched you both, perhaps some blood god is merely happy at your mishap.
  19. Their swing is about to cleave into your throat and you are suddenly in the Dead Realm. Any spirits or undead in the area are still present, otherwise it is empty, grey, cold, foggy. You can move about for 1 round and then you will re-appear wherever you moved to. Any valuable treasure or items are but dust in the Dead Realm, unless you brought them in yourself.
  20. Both of your weapons bind and break. If either of you were using magical weapons, said weapons can save against breakage. (Roll a 4 or more on a d6, adding the weapon’s magical bonus.)
You could just roll a d6 against this table, or a d12 if you don’t want random magical war-sigils to show up in your theatre of the mind, or random Dead Realm trips.

Installing XMPP/Jabber Messaging Server

Installing XMPP/Jabber Messaging Server

XMPP/Jabber is open simple protocol for messaging. It is very good replacement for previously famous messaging services like ICQ, AIM, MSN… Main disadvantage of these services was that if they was not acessible for some time, you couldn`t do anything… and second, all was proprietary protocols so you could use only official client programs (in most cases full of advertisements). Unofficial clients was not always working like they should. If I can I will always choose open source alternative over proprietary piece of software. In case of instant messaging too. Jabber adresses work in the same way as standard email addresses – it is composed of 2 parts: account@domain.com. You can use some providers which will provide you Jabber account for free (list here), but you can also build your own server. So why not to run XMPP/Jabber server on my Raspberry Pi. I strongly recommend using domain instead of IPs and ensure that RPi is accessible under static IP address. All will work even without this two things but will sooner or later they will cause problems.
There are more XMPP/Jabber server implementation for RPi. The most used are Prosody and ejabberd. Prosody is much more lightweight but ommit some advanced functions. So I decided to install it.

apt-get install prosody

After succesful installation open its main configuration file

nano /etc/prosody/prosody.cfg.lua

In configuration file add this line, change domain according to yours

VirtualHost “domain.com

Now there are some other directories you should edit

admins = {“admin@domain.com“} # this account will have rights to administer server through messages
allow_registration = true     # set to true or false, if you want that anybody can create account through IM client
welcome_message = “Welcome $user”            # message shown to newly registered accounts
registration_watchers = {“admin@domain.com“} # informs admin about new registrations

Now close and save configuration file and restart Prosody

/etc/init.d/prosody restart

Now create a administrator account for prosody manually. In the terminal write

prosodyctl adduser admin@domain.com

On other device install some Jabber client and try to connect to this account. Everything should work. It is not common to use admin account for messaging, create another account, for example via Pidgin.

Creating new Jabber account

Creating new Jabber account
If you choose to not allow registration of new acconts, you will have to create all accounts in command line. use this commands, they are quite self-explanationary.

prosodyctl adduser user@domain.com  # adds a new user
prosodyctl deluser user@domain.com  # deletes an existing account
prosodyctl passwd  user@domain.com  # change password to existing account

Now you should be able to send messages to people from other domains, not only yours.
NOTE: If you are using standard ports for Jabber server you do not have to set this. If you changed default ports, you will have to set SRV DNS records. 

_xmpp-server._tcp.domain.com. IN SRV 0 0 5269 hostname.
_xmpp-client._tcp.domain.com. IN SRV 0 0 5222 hostname.
_jabber._tcp.domain.com. IN SRV 0 0 5269 hostname.

There are 3 records, first is port for server to server communication, second is for client to server communication. Third is only for backwards compatibility, set there the same port as in server to server statement.
NOTE2: In client to server communication is used asymetric certificate. Its keys are automaticaly generated at installation, but you can also get validated certificates for your Jabber server from StartSSL for free.

Reference Sheet by Alex Schroeder

Files, Buffers, Windows
C-x C-f Find file (“Open”)
C-x C-s Save buffer (“Save”)
C-x C-w Write file (“Save As…”)
C-x 2 Split window
C-x 1 Delete other windows (“Unsplit”)
C-x o Other window
C-x C-b Buffer menu
Search and replace
C-s Incremental search string forwards
C-r Incremental search string backwards
M-% Query replace string
C-M-s Incremental search regexp forwards
C-M-r Incremental search regexp backwards
C-M-% Query replace regexp
C-a Beginning of line
C-e End of line
C-k Kill line (“cut line”)
M-b Backwards word
M-f Forwards word
M-d Kill word (“cut word”)
Balanced expressions such as “foo” or (foo)
C-M-b Backwards sexp
C-M-f Forwards sexp
C-M-k Kill sexp
Region (between mark and point)
C-SPC Set mark
C-w Kill region (“cut”)
M-w Copy region (“copy”)
Pasting, Undoing
C-y Yank (“paste”)
C-y M-y Yank older copy (M-y…)
C-_ Undo, anything else interrupts the undo chain
C-x r k Kill rectangle
C-x r y Yank rectangle