• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. Tildee — A python library for interacting with Tildes

      Update! After a few hours of struggling I managed to set up Read the docs for Tildee, it should help using the library significantly. After getting some inspiration from TAPS I thought that maybe...

      Update! After a few hours of struggling I managed to set up Read the docs for Tildee, it should help using the library significantly.

      After getting some inspiration from TAPS I thought that maybe I try to work on something vaguely similar on my own. And after… some? hours of coding today I came up with this: tildee.py (source)
      It's a wrapper for the Tildes Public/Web API that is already used by the site internally to make it work. The obvious problem with that is that it will at one point break when this unstable API is changed. It can do basically all things a normal user can do with the notable exception of applying comment labels (because I haven't gotten around to that yet).

      Example of usage for a DM reply bot (result):

      import sys
      from tildee import TildesClient
      import time
      
      # Initialize client and log in, 2FA isn't supported yet and will probably break in horrible ways
      t = TildesClient("username", "password", base_url="https://localhost:4443", verify_ssl=False)
      
      while True:
          # Retrieve the "unread messages" page and get a list of the conversations there
          unread_message_ids = t.fetch_unread_message_ids()
          for mid in unread_message_ids:
              # Access the conversation history page; this also clears the "unread" flag 
              conversation = t.fetch_conversation(mid)
              # Get the text of the last message
              text = conversation.entries[-1].content_html
              # Abort if it's from the current user (I don't think this could actually happen)
              if conversation.entries[-1].author == t.username:
                  break
              print(f"Found a message by {conversation.entries[-1].author}")
              # If the message contains a reference, reply in kind
              if "hello there" in text.lower():
                  print("Replying…")
                  t.create_message(mid, f"General {conversation.entries[-1].author}! You are a bold one.")
              # Delay before processing next unread message
              time.sleep(3)
          # Delay before next unread check
          time.sleep(60)
      

      This has a lot of potential. Haven't yet figured out potential for what, but I'll take what I can get.
      I'd be really grateful if someone with a little more experience than me (that's not exactly a high bar :P) could give me some pointers on the project's structure and the "API design", hence the ask tag. Other creative ideas for what to use this for are appreciated, too.

      47 votes
    2. What are you reading these days? #22

      What are you reading currently? Fiction or non-fiction, any genre, any language! Tell us what you're reading, and talk a bit about it. Notes: I am aiming to make a list of all the books mentioned...

      What are you reading currently? Fiction or non-fiction, any genre, any language! Tell us what you're reading, and talk a bit about it.

      Notes: I am aiming to make a list of all the books mentioned in toplevel comments in these threads, see this wiki page. If you want to help with that, that'd really be appreciated, PM me please.

      Past weeks: Week #1 · Week #2 · Week #3 · Week #4 · Week #5 · Week #6 · Week #7 · Week #8 · Week #9 · Week #10 · Week #11 · Week #12 · Week #13 · Week #14 · Week #15 · Week #16 · Week #17 · Week #18 · Week #19 · Week #20 · Week #21

      15 votes
    3. Democratic Debate #1 Thread (Night 2)

      welcome to debate #1, night 2. the first thread on this turned out to be about twice as active as i was expecting (i estimated at most 50 or so replies), and that was for the "undercard" so unless...

      welcome to debate #1, night 2. the first thread on this turned out to be about twice as active as i was expecting (i estimated at most 50 or so replies), and that was for the "undercard" so unless something changes with this night, i think we'll be doing these in pairs from here on out--at least until either the DNC pushes out enough candidates for one debate, or activity drops significantly in these threads. previous night's thread can be found here if you'd like to continue the discussions of last night's candidates. anyways here are all the details you'd ever need, and probably then some:

      first off, i recommend you sort by newest first instead of the default since this thread will likely be semi-active and covering a live event.

      How to Watch:

      The debate is being broadcast by NBC News, MSNBC and Telemundo, and will air live across all three networks starting at 9 p.m. ET.
      Telemundo will broadcast the debate in Spanish.
      The debate will stream online free on NBC News' digital platforms, including NBCNews.com, MSNBC.com, the NBC News Mobile App and OTT apps on Roku, Apple TV and Amazon Fire TV, in addition to Telemundo's digital platforms.

      livestreams will also be available on Twitter, Facebook, and Youtube because the DNC mandated that of its partners for the debates.

      The Candidates:

      Democratic Presidential Debate: See The 20 Candidates Who Will Be Onstage

      • Michael Bennet (Senator from Colorado)

      Bennet is running on fixing a broken political system, the blame for which he puts at the feet of Republican Senate leader Mitch McConnell. Bennet says spending from wars and tax cuts was essentially the U.S. lighting “money on fire.”

      • Joe Biden (Former vice president)

      Biden’s top concern is less about reshaping America and more about returning America to “normalcy.” He argues that if President Trump gets another four years, the DNA of the country will be fundamentally altered.

      • Pete Buttigieg (Mayor of South Bend, Ind.)

      The 37-year-old is making a generational-change argument. He argues for progressive processes — like fixing redistricting and voting rights — in addition to policies — like being more cautious on war and more progressive on climate change and health care.

      • Kirsten Gillibrand (Senator from New York)

      She’s focused on women’s rights, especially when it comes to health care. She boasts that a Fox host called her “not very polite” for speaking out about the “nationwide assault on women’s reproductive freedoms” and “fundamental human rights for women.”

      • Kamala Harris (Senator from California)

      Harris’ slogan is “for the people,” and she’s making the case that President Trump is a “fraud.” The former prosecutor says Trump is fighting for the wrong people — the powerful and wealthy — while she wants to “advocate for the voiceless and vulnerable.”

      • John Hickenlooper (Former governor of Colorado)

      The centrist has a pragmatic message. He says pragmatists aren’t against big things; they know how to get them done. He has also spoken out against Democrats’ lurch toward socialism, warning that moving in that direction would reelect President Trump.

      • Bernie Sanders (Senator from Vermont)

      Sanders wants to beat President Trump, but he believes the way to do it is not with “middle-ground” approaches, but with promising wholesale progressive change. He’s the only candidate willing to wear the (democratic) socialist label.

      • Eric Swalwell (Representative from California’s 15th District)

      He has focused his campaign on ending gun violence in the country, targeting semiautomatic assault weapons in particular by calling for a mandatory national ban and buyback.

      • Marianne Williamson (Spiritual guru, entrepreneur)

      The New Age author is campaigning with a philosophy of “Think. Love. Participate.” As an outsider to politics, she believes change needs to come from the outside and that “half-truth tellers” can’t beat President Trump.

      • Andrew Yang (Founder of Venture for America)

      The startup investor is running on a data-first approach to the presidency. His big idea is to address the threat of automation with a Universal Basic Income, in which every adult would get $1,000 a month.

      The Rules:

      Candidates will have 60 seconds to answer questions and 30 seconds to respond to follow-ups. No opening statements, though candidates will have a chance to deliver closing remarks.
      Five segments each night separated by four commercial breaks.

      The Analysis:

      NPR has 7 questions of their 8 for the debates which apply to today's debate:

      Will Biden stand up to the scrutiny?
      Is the debate an opportunity or danger zone for Bernie Sanders?
      Can Harris and Buttigieg stand out?
      Do the pragmatists or progressives win out?
      How much of a focus is Trump?
      How will foreign policy factor in?
      Who will stick in voters' minds?

      other pre-debate analysis pieces that may be pertinent to you:

      34 votes
    4. Tildes User Script: Youtube Thumbnails Below Topic Title

      A screenshot. Following is a user script that embeds a thumbnail into the topic header. Was supposed to be trivial, but walking around the CSRP was not that easy. Luckily, someone had written a...

      A screenshot.

      Following is a user script that embeds a thumbnail into the topic header. Was supposed to be trivial, but walking around the CSRP was not that easy. Luckily, someone had written a nice useful custom Base64 encoder, because I spent more than an hour trying to get btoa to do the thing.

      // ==UserScript==
      // @name     tildesYoutubeThumbs
      // @version  1
      // @grant    GM.xmlHttpRequest
      // @namespace   tildes.net
      // @include     https://tildes.net/~*/*
      // ==/UserScript==
      
      let youtubeIcon = document.querySelector('div.topic-icon-youtube_com')
      
      if(youtubeIcon !== null) {
        let youtubeLink = youtubeIcon.nextSibling.nextSibling.href;
        let youtubeID = new URL(youtubeLink).searchParams.get('v');
        let thumbnailUrl = "https://img.youtube.com/vi/" + youtubeID + "/0.jpg";
      
        GM.xmlHttpRequest({
          method: "GET",
          url: thumbnailUrl,
          overrideMimeType: 'text/plain; charset=x-user-defined',
          onload: function(response) {
            if(response.status === 200) {
              let thumbElement = document.createElement('img');
              let thumbParentDiv = document.createElement('div');
              let header = document.querySelector('article.topic-full > header');
              let data = "data:image/jpeg;base64," + customBase64Encode(response.responseText);
              thumbElement.src = data;
              thumbElement.style = 'width: 60%; margin: auto';
              thumbElement.id = 'gk-youtube-thumbnail';
              thumbParentDiv.style = 'width: 100%; text-align:center;';
              header.appendChild(thumbParentDiv);
              thumbParentDiv.appendChild(thumbElement);
            }
          }
        });
      }
      
      // https://stackoverflow.com/questions/8778863/downloading-an-image-using-xmlhttprequest-in-a-userscript/8781262#8781262
      function customBase64Encode (inputStr) {
          var
              bbLen               = 3,
              enCharLen           = 4,
              inpLen              = inputStr.length,
              inx                 = 0,
              jnx,
              keyStr              = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
                                  + "0123456789+/=",
              output              = "",
              paddingBytes        = 0;
          var
              bytebuffer          = new Array (bbLen),
              encodedCharIndexes  = new Array (enCharLen);
      
          while (inx < inpLen) {
              for (jnx = 0;  jnx < bbLen;  ++jnx) {
                  /*--- Throw away high-order byte, as documented at:
                    https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data
                  */
                  if (inx < inpLen)
                      bytebuffer[jnx] = inputStr.charCodeAt (inx++) & 0xff;
                  else
                      bytebuffer[jnx] = 0;
              }
      
              /*--- Get each encoded character, 6 bits at a time.
                  index 0: first  6 bits
                  index 1: second 6 bits
                              (2 least significant bits from inputStr byte 1
                               + 4 most significant bits from byte 2)
                  index 2: third  6 bits
                              (4 least significant bits from inputStr byte 2
                               + 2 most significant bits from byte 3)
                  index 3: forth  6 bits (6 least significant bits from inputStr byte 3)
              */
              encodedCharIndexes[0] = bytebuffer[0] >> 2;
              encodedCharIndexes[1] = ( (bytebuffer[0] & 0x3) << 4)   |  (bytebuffer[1] >> 4);
              encodedCharIndexes[2] = ( (bytebuffer[1] & 0x0f) << 2)  |  (bytebuffer[2] >> 6);
              encodedCharIndexes[3] = bytebuffer[2] & 0x3f;
      
              //--- Determine whether padding happened, and adjust accordingly.
              paddingBytes          = inx - (inpLen - 1);
              switch (paddingBytes) {
                  case 1:
                      // Set last character to padding char
                      encodedCharIndexes[3] = 64;
                      break;
                  case 2:
                      // Set last 2 characters to padding char
                      encodedCharIndexes[3] = 64;
                      encodedCharIndexes[2] = 64;
                      break;
                  default:
                      break; // No padding - proceed
              }
      
              /*--- Now grab each appropriate character out of our keystring,
                  based on our index array and append it to the output string.
              */
              for (jnx = 0;  jnx < enCharLen;  ++jnx)
                  output += keyStr.charAt ( encodedCharIndexes[jnx] );
          }
          return output;
      }
      
      15 votes
    5. What have you done lately that you're proud of?

      Anything you've been working at lately and finally got it done? Anything you finally got around to finishing/starting? Anything big happening? Feel free to gush about anything you've done but want...

      Anything you've been working at lately and finally got it done? Anything you finally got around to finishing/starting? Anything big happening? Feel free to gush about anything you've done but want to talk about!

      Yesterday I decided to pick my acoustic guitar back up and learn Blackbird by The Beatles (Only mildly inspired by Kmac). Today I got it all down! Feeling super proud that I nailed a song like that so quickly after having played bass almost primarily for a while now.

      23 votes
    6. Has Wine begun to remove the need for linux software?

      I started using wine in about 2013 and I remember back then it was quite patchy and only worked on some programs/games. I used to have a rule that I stuck hard to that I would not buy any games...

      I started using wine in about 2013 and I remember back then it was quite patchy and only worked on some programs/games. I used to have a rule that I stuck hard to that I would not buy any games that did not have a linux version. But now in 2019 I have found that everything I have tried to run in wine has been so seamless and close to flawless that I hardly know its running in wine. I semi regularly buy games that only have windows version because I am mostly sure it will work and can get a refund if it doesn't.

      What does everyone else think about this?

      8 votes
    7. A system for "starred" posts on sensitive/advice topics

      This was inspired by this post. I was thinking, as a platform gets bigger we're going to end up with more situations where people are asking for advice about fairly serious stuff. In some cases,...

      This was inspired by this post.

      I was thinking, as a platform gets bigger we're going to end up with more situations where people are asking for advice about fairly serious stuff. In some cases, that advice needs to come from experts and taking guidance from any random Joe on the street can be risky/dangerous. (For the record, I don't think the post I'm referencing is an example of this, it just got me thinking about it).

      In cases like this, I think it's important that the actual good advice get some kind of clear designation that THIS is the guidance you need to take first. I notice this in communities like /r/Fitness a lot where people will post about what sound like pretty serious health concerns and you get a fair number of posts that suggest toughing it out or whatever and the more critical "You need to see a doctor" posts can kind of disappear amid the discussion. Similar things in /r/relationships where you can't always count on "This is abuse. Make arrangements to get your kids and yourself somewhere safe. . ." to be the top post.

      Even in cases where the poster themselves is smart enough to take "YOU NEED TO SEE A DOCTOR" type advice to heart, not every schmuck searching the topic on Google will. To that end, it might be good to give certain posts with good, holistic advice or by a known expert some kind of visual indicator that it deserves to be taken more seriously than other posts in the thread. It wouldn't be censoring anything really, just providing a little nudge about what ought to be consulted first or taken to heart.

      Now obviously it gets hard to decide how to give a post this attribute. It could possibly be awarded by the OP, though that has some obvious issues where the OP themselves might not be in a position to credibly vet the advice they're getting. We could also just do it through ranking by vote, which is the default paradigm. But like I said, it doesn't always work so well on Reddit. And the Exemplary tag is invisible to others, so that doesn't work either (and the post itself might not be worth giving up your "Exemplary" for the day besides). Moderators could do it, but there may not be enough and the skillset to be a Mod might not overlap with the skillset to know what advice a person needs in a particular situation.

      I don't actually have the answers. Maybe it just comes down to creating an attribute for some users to be "wisened elders" or something and empower them to star certain posts to separate good advice from bad. It would basically be a trusted user system. It's got it's own problems, but I guess we can open the floor for other ideas. Maybe it's not a real concern. Maybe it's better addressed by tinkering with the sorting of posts.

      11 votes