Sindre’s Awesome List

Sindreโ€™s Awesome List

Contents

Platforms

Programming Languages

Front-End Development

Back-End Development

Computer Science

Big Data

Theory

Books

Editors

Gaming

Development Environment

Entertainment

Databases

Media

Learn

Security

Content Management Systems

Hardware

Business

Work

Networking

Decentralized Systems

Health and Social Science

Events

Testing

Miscellaneous

Related

Platforms

Node.jsโ€ฆ

View On WordPress

Cassinelli Feedback

Updated 10032022-171726

Shortcuts User Group Discord Message

Gist

Secret Gist

Drafts

WTF

Local

Simplenote Local

Things

โ€”

Original Discord Message

GitHub Gist

WTF Documentation Page

โ€”

https://gist.github.com/extratone/fed42b233266777d98d155faa7481548.js

https://gist.github.com/extratone/9dd2198ea08ff3c21c48a34d64e2c6d6.js

โ€”

Unresolved

Personal Automations screen always lags whenโ€ฆ

View On WordPress

Command Line Tumblr

engineering:

A Totally New Interface for Tumblr?

Today, Tumblr is accessible via mobile, web or apiโ€”but what if youโ€™re a linux enthusiast? Nerds like you can now access Tumblr completely via command line.

โ€œWhat about images?โ€ you ask. Displaying an image in command line is not something new. There are already a bunch of existing libs doing this, namely aalib, libcaca and super low level ncurses. And the most interesting project built based on thoseโ€”p2p video chatโ€”comes from a hackathon.

I picked up a much higher level library called blessed, for least efforts to achieve a best looking interface. As you may seen, blessed is javascript-based and very fancy. It provides you with almost every widget you might need to build an awesome dashboard.

Most of the work has already been done after figuring out the right library, to show tumblr in command line, we just need to

  • Connect the api to fetch image urls.
  • Do some front-end design to show a Tumblrish dashboard.

What? Still need codes?โ€ฆ

var post = blessed.box({
    parent: dashboard,
    top: '15%',
    left: 'center',
    width: '40%',
    height: '80%',
    draggable: true,
    border: {
        type: 'line'
    },
    style: {
        fg: 'white',
        bg: 'white',
        border: {
            fg: '#f0f0f0'
        }
    },
});

var load_post = function() {
    if (index < 0 || index >= posts.length)
        return;

    post.free();
    var post_data = posts[index];
    /** avator */
    blessed.ANSIImage({
        parent: post,
        top: 0,
        left: '-30%',
        width: '20%',
        height: '20%',
        file: post_data.avator,
    });

    /** posts */
    var count = post_data.count;
    // TODO: switch all sizes
    for (var i = 0; i < count; i++) {
        var offset = 100/count * i;
        var width = 100/count;
        blessed.ANSIImage({
            parent: post,
            left: offset + '%',
            width: width + '%',
            height: '98%',
            file: post_data.data[i]
        });
    }

    screen.render();
}

Blessed already provided lots of high level apis. As an example, to display a post as an image, all your input is just an image url, and call

blessed.ASNImage({
    ...
    file: image_url/local_file
})

It supports png and gif, and even, if youโ€™d like to show a video, blessed also provides video. Hypothetically speaking, we can use this library to build almost all components in the dashboard of Tumblr today. Note, itโ€™s not connecting the real api, but I suppose that would be pretty easy. Also thereโ€™s a memory optimization issue might need to be addressed if we really want to use this library for something.

tumblr.js update

javascript:

We just published v1.1.0 of the tumblr.js API client. We didnโ€™t make too much of a fuss when we released a bigger update in May, but hereโ€™s a quick run-down of the bigger updates you may have missed if you havenโ€™t looked at the JS client in a while:

  • Method names on the API are named more consistently. For example, blogInfo and blogPosts and blogFollowers rather than blogInfo and posts and followers.
  • Customizable API baseUrl. We use this internally when weโ€™re testing new API features during development, and itโ€™s super convenient.
  • data64 support, which is handy for those times when you have a base64-encoded image just lying around and you want to post it to Tumblr.
  • Support for Promise objects. Itโ€™s way more convenient, if you ask me. Regular callbacks are still supported too.
  • Linting! Weโ€™ve been using eslint internally for a while, so we decided to go for it here too. Weโ€™re linting in addition to running mocha tests on pull requests.

Check it out on GitHub and/or npm and star it, if you feel so inclined.

tumblr.js REPL

When we were updating the API client, we were pleasantly suprised to discover a REPL in the codebase. If you donโ€™t know, thatโ€™s basically a command-line console that you can use to make API requests and examine the responses. We dusted it off and decided to give it its own repository. Itโ€™s also on npm.

If youโ€™re interested in exploring the Tumblr API, but donโ€™t have a particular project in mind yet, itโ€™s a great way to get your feet wet. Try it out!

Columbia Local Bot

Updated 10032022-004638

GitHub Issue

GitHub Wiki Page

Telegram Link

Alternate Telegram Link

Announcement message

r/columbiamo Subreddit Autoposting Poll

WTF

WTF Shortlink โ€“ https://davidblue.wtf/columbiamobot

Repository File

Telegraph

Backup

Things

https://t.me/columbiamo/14723

Social

Howdy, folks!

This is a semi-formal announcement, I suppose.

Iโ€™ve created a very simple Telegramโ€ฆ

View On WordPress

How to Update all Python Packages with a Single pipย Command

The Psalms PyPiALT

Ensure all present Python packages on Windows and Linux systems are parallel with their latest available versions from the command line.

With Python, the best practice of pinning all the packages in an environment at a specific version ensures that the environment can be reproduced months or even years later.

  • Pinned packages in a requirements.txt file are denoted by ==. For example, requests==2.21.0. Pinned packages should never be updated except for a very good reason, such as to fix a critical bug or vulnerability.
  • Conversely, unpinned packages are typically denoted by >=, which indicates that the package can be replaced by a later version. Unpinned packages are more common in development environments, where the latest version can offer bug fixes, security patches and even new functionality.

As packages age, many of them are likely to have vulnerabilities and bugs logged against them. In order to maintain the security and performance of your application, youโ€™ll need to update these packages to a newer version that fixes the issue.

The pip package manager can be used to update one or more packages system-wide. However, if your deployment is located in a virtual environment, you should use the Pipenv package manager to update all Python packages.

NOTE: be aware that upgrading packages can break your environment by installing incompatible dependencies. This is because pip and pipenv do not resolve dependencies.

Python Package Upgrade Checklist

In general, you can use the following steps to perform a package upgrade:

  1. Check that Python is installed

Before packages can be updated, ensure that a Python installation containing the necessary files needed for updating packages is in place by following the steps outlined in “[Using Python on Windows]” in the official documentation.

  1. Get a list of all the outdated packages

To generate a list of all outdated packages:

pip list –outdated

  1. Upgrade outdated packages

Depending on your operating system or virtual environment, refer to the following sections.

The easiest way to update all packages in a Windows environment is to use pip in conjunction with Windows PowerShell:

  1. Open a command shell by typing powershell in the Search Box of the Task bar
  2. Enter:

pip freeze | %{$_.split(’==’)[0]} | %{pip install –upgrade $_}

This will upgrade all packages system-wide to the latest version available in the Python Package Index (PyPI).

Update all Python Packages on Linux

Linux provides a number of ways to use pip in order to upgrade Python packages, including grep and awk.

To upgrade all packages using pip with grep on Ubuntu Linux:

pip3 list –outdated –format=freeze | grep -v ’^-e’ | cut -d = -f 1 | xargs -n1 pip3 install -U

To upgrade all packages using pip with awk on Ubuntu Linux:

pip3 list -o | cut -f1 -d’ ’ | tr “ ” “n” | awk ’{if(NR>=3)print)’ | cut -d’ ’ -f1 | xargs -n1 pip3 install -U

Updating Python Packages on Windows or Linux

Pip can be used to upgrade all packages on either Windows or Linux:

  1. Output a list of installed packages into a requirements file (requirements.txt):

pip freeze > requirements.txt

  1. Edit requirements.txt, and replace all == with >=. Use the Replace All command in the editor.
  2. Upgrade all outdated packages:

pip install -r requirements.txt –upgrade

Updating all Packages in a Virtual Environment

The easiest way to update unpinned packages (i.e., packages that do not require a specific version) in a virtual environment is to run the following Python script that makes use of pip:

import pkg_resources from subprocess import call for dist in pkg_resources.working_set: call(“python -m pip install –upgrade ” + dist.<projectname>, shell=True)

Updating all Packages in a Pipenv Environment

The simplest way to update all the unpinned packages in a specific virtual environment created with pipenv is to do the following steps:

  1. Activate the Pipenv shell that contains the packages to be upgraded:

pipenv shell pipenv update

How to Update All Python Packages

How to Update All Pythonย Packages

How to Update All Python Packages
Archive
pip Update Shortcut
Medium

Shell Commands
pip list –outdated
pip freeze | %{$_.split(’==’)[0]} | %{pip install –upgrade $_}
pip3 list –outdated –format=freeze | grep -v ’^-e’ | cut -d = -f 1 | xargs -n1 pip3 install -U
pip3 list -o | cut -f1 -d’ ’ | tr “ ” “n” | awk ’{if(NR>=3)print)’ | cut -d’ ’ -f1 | xargs -n1 pip3 install -U
pip freeze >โ€ฆ

View On WordPress

Convert TextExpander Snippets to iOS/OS X Text Shortcuts

mosx:

TextExpander Snippets to iOS/OS X Text Shortcuts

Here is something Iโ€™ve been working on for quite a while now. I first had the idea for this when I went to Vienna. I was annoyed that Apple still didnโ€™t allow TextExpander to do what I love it to do. Three weeks ago it looked bad for TextExpander already, now, a couple of weeks later, it looks even worse.

Since Mavericks, Text Shortcuts (System Preferences โ†’ Keyboard โ†’ Text) sync with iOS devices. I started thinking how to automate adding new shortcuts by script. Scripting the UI is, obviously and technically, my least favorite option, but itโ€™s what I ended up doing.

If you are interested in the technical difficulties that I had to overcome, which make this script work the way it does, read on. Otherwise head to the end to download.

How OS X Text Shortcuts Work

When a new Text Shortcut gets added in the System Preference pane Keyboard โ†’ Text, OS X does a couple of things.

First it saves a โ€œreceiptโ€ of this addition/removal to ~/Library/Mobile Documents/com~apple~TextInput/ in there are a couple of folders. Most important are those with your username. Open that folder and you see UserDictionary with a subfolder. Select the ones with โ€œ~โ€ in their name.

Every time you add or remove a new shortcut a zipped plist will be saved here, containing an Epoch timestamp, the shortcut and the phrase (as Apple calls expansions). Some other data is in the plist as well, but the important bits are the ones I just described.

The other important folder is in ~/Library/Dictionaries/CoreDataUbiquitySupport. This folder looks similar. It contains two folders, somewhere you will find a UserDictionary.db file. This is a SQLite database.

When a new shortcut gets added, a new row will be created here. Again Epoch timestamp, shortcut, and phrase are the important pieces.

What Does Not Work

My first guess was to add new โ€œreceiptโ€ files to Mobile Documents. I was hoping that OS X would realize thereโ€™s a new file, read it and add it to OS X Text Shortcuts, and that this would also transfer new shortcuts to an iOS device. It does not.
Adding new files here with a similar structure does not update the System Preference pane Table View, nor does it make an iOS device recognize the addition.

I started tinkering with SQLite then. The SQLite database in Dictionaries is only used to feed the Table View displayed in System Preferences. Add new rows here with a similar structure, restart System Preferences, and you will see the new shortcut. Editing the database files does not trigger iCloud to sync shortcuts.

At this point I was pretty disappointed and took my least favorite route, UI scripting. I know itโ€™s hacky, I know itโ€™s dirty, I know all that, but scripting the UI lead to a working solution.
Maybe looking a bit more into Mobile Documents would eventually have resulted in a better solution. I weighed the time it would take me to figure this out against the time it takes me to make a first running version. I prefer things to be done.

How This Script Works

PLEASE READ THIS, IT IS IMPORTANT! ALL YOUR EXISTING SHORTCUTS WILL GO POOF!

  1. Open System Preferences โ†’ Keyboard โ†’ Text
  2. Click the Table View, select all, press backspace. This deletes all existing shortcuts and takes a moment or two.
  3. Turn off TextExpander text expansion. This is important. Otherwise when the script types the phrase, TextExpander would expand the abbreviation.
  4. It will then compile a list of all your TextExpander snippets.
  5. The script will then click +, type out the abbreviation, โ‡ฅ to the next cell, paste the expansion from the clipboard, press return.
  6. After it has completed typing all shortcuts, TextExpander text expansion will be turned back on.

A few things to note:

  1. As the script automates the UI, just sit and watch. It takes about 4:40 minutes to type in about 300 snippets.
  2. The clipboard is used, because this way the expansion can have multiple lines.
  3. This script is smart enough not to process any dynamic snippets. Dynamic snippets use date calculations, Fill-Ins, and any script snippets.
  4. It takes a while for the list of snippets to be compiled. If AppleScript Editor says โ€œRunningโ€ฆโ€ at the bottom, the script is still running.
  5. If you hear an error beep you may have luck running the script again. Sorry this happens sometimes, I couldnโ€™t figure out why.
  6. Set all snippet groups that you donโ€™t want to be added in disallowedGroups. The name must match the snippet groupโ€™s name.

If you want to know how many snippets you have, comment out the part where the script starts adding all Text Shortcuts. There is a line

log "Count of abbreviationList: " & (count of abbreviationList)

After this insert (*, and *) way at the end.

Download

GitHub

Oh my god… I (and others I know) have been somewhat desperately searching for this very solution for like 18 months now lol.

overheard at the most vast indie coffee shop I’ve ever seen (yes, including those in Portland:)

๐˜ฃ๐˜ณ๐˜ฐ,
๐˜บ๐˜ฐ๐˜ถ ๐˜ธ๐˜ข๐˜ฏ๐˜ฏ๐˜ข ๐˜ณ๐˜ฆ๐˜ข๐˜ฅ ๐˜›๐˜ฉ๐˜ฆ ๐˜‹๐˜ช๐˜ท๐˜ช๐˜ฏ๐˜ฆ ๐˜Š๐˜ฐ๐˜ฏ๐˜ด๐˜ฑ๐˜ช๐˜ณ๐˜ข๐˜ค๐˜บ ๐˜ต๐˜ฐ๐˜จ๐˜ฆ๐˜ต๐˜ฉ๐˜ฆ๐˜ณ?