Levell Tech

Posts

Published - ydl-fetch

My wrapper for youtube-dl / yt-dlp has been published to GitHub at github.com/palevell/ydl_fetch

Disabling Laptop Touch Devices

When I set up a new laptop, I add commands to toggle the on-board touchpad ON/OFF. I don't permanently disable it because there are times when a mouse is not available. The laptop I just setup has a touchpad and a "touch stick." This presented a challenge–how to put multiple commands in a single BASH alias, to disable both at the same time. My solution is as follows: The above code is just a snippet that I placed into my ~/.

PATCH - Long Tweets in youtube-dl (updated)

I finally had a chance to dig into this a bit further, and devised a more permanent fix (see the gist, below). If you have been experiencing 'Cannot write' errors when trying to download Twitter videos with youtube-dl, it could be due to the number of characters in the tweet. Twitter now allows 280 characters per tweet, while many file systems have a 255-character limit for filenames. There is a simple patch to fix this issue, as follows:

Tweepy with Django-Allauth

I have spent a good portion of this year developing Twitter software. Some of it is for research, account maintenance, and retweeting. Now, I am ready to put some of what I developed online, for public use. I had been learning the Flask web framework, but it seemed inadequate for what I wanted to do–namely keep user data private (including API keys). For the last month or so, I have been banging-out Django code, mostly from tutorials.

Fernet Encryption Example

After being less than satified with the results of my efforts to incorporate encryption into one of my Flask projects with existing Flask modules, I started researching what is generally available for Python, here and here, which led me to the cryptography package. From the project description: cryptography is a package which provides cryptographic recipes and primitives to Python developers. Our goal is for it to be your "cryptographic standard library".

Flask-vs-Django

{: .center-image} I used the Flask web framework, first. Miguel's Flask Mega Tutorial is a great way to learn Python A few quick web searches for Django vs. Flask articles indicated that Flask was the way to go. When I got to the data encryption part of my app, Flask was a disaster. I encountered abandoned modules and tutorials that don't work–more so than usual for the Python community (I have a separate rant on that).

Advanced Task Scheduling with launchd

I recently finished a project that involved generating lists of top ten tweets. It was scheduled to run twice a day, six days a week, and once on the day that the weekly top 40 list ran. This was easy to do as a cron job, as shown below: 00 8 * * * /path/to/topten.py 00 20 * * 1-6 /path/to/topten.py Most of the examples of using launchd .plists only include jobs that occur once a day or on-demand, and the documentation doesn't make it clear how complex task schedules are set up.

PATCH - Long Tweets in youtube-dl

If you have been experiencing 'Cannot write' errors when trying to download Twitter videos with youtube-dl, it could be due to the number of characters in the tweet. Twitter now allows 280 characters per tweet, while many file systems have a 255-character limit for filenames. There is a simple patch to fix this issue, as follows:

PPC Twitterbot Project

Back in February, I started a research project using the Tweepy library in Python. Around that time, the leader of the People's Party of Canada (PPC), Maxime Bernier, asked people to follow the accounts that he followed, and retweet their tweets. That was a big job, so I wrote a Python script to create a list to which others could subscribe. The next task was to isolate PPC-related tweets. This was the genesis of my twitter bot.

Pelican Themes Randomizer

To streamline testing operations, I opted to move the theme-picker out of the pelican settings file. With this setup, this script random_theme can be executed before building the site, as shown in the following example: ./random_theme ; make clean devserver – Enjoy! <script src="https://gist.github.com/palevell/111bad0abe970095746d1d85bdde20bf.js"></script>
Twitter GitHub GitLab LinkedIn