The use of __main__.py
to create executables
myprojectfolder/
|_ __main__.py
|_ __init__.py
Being __main__.py
:
print("Hello")
#!/usr/bin/python | |
# Plugin by Sinan Nalkaya <sardok@gmail.com> | |
# See LICENSE of Terminator package. | |
""" logger.py - Terminator Plugin to log 'content' of individual | |
terminals """ | |
import os | |
import sys |
def _remap_dict(d, fromto_mapping, method='delete'): | |
""" | |
Remap dictionary keys from a certain set of keys to a new set of keys | |
:param d: the dictionary that needs to be remapped | |
:param fromto_mapping: a dictionary mapping of keys in the original dictionary to the output dictionary | |
:param method: what do do with keys that aren't found in the mapping | |
'delete' means that they will be removed from the output dictionary | |
'remain' means that they will have their original names in the output dictionary | |
:return: the output dictionary with keys remapped, will return None if method is not recognized | |
""" |
The use of __main__.py
to create executables
myprojectfolder/
|_ __main__.py
|_ __init__.py
Being __main__.py
:
print("Hello")
Reference: RFC 2616 - HTTP Status Code Definitions
# stepper.py | |
# A micropython driver for 4-phase, unipolar stepper motors such as | |
# the 28BYJ-48 | |
# Relesed to the Public Domain by Nicko van Someren, 2020 | |
# The constructor for the Stepper class takes as arguments the four | |
# pins for driving the motor phases, in phase order, and optionally a | |
# timer. The pins can be passed as pin numbers or machine.Pin objects |
""" | |
If you are not using this inside a cog, add the event decorator e.g: | |
@bot.event | |
async def on_command_error(ctx, error) | |
For examples of cogs see: | |
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be | |
For a list of exceptions: | |
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#exceptions |
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav | |
# To convert all mp3 files in a directory in Linux: | |
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done | |
# Or Windows: | |
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav |
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
Given a subscribed calendar with a url like
https://example.com/example.ics
To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like
https://example.com/example.ics#1
Adding the anchor tag will force Google Calendar to think of it as a new calendar