Use the Pillow module for Python to "roll" images horizontally or vertically. When an image is rolled, it is shifted in some direction. The part of the image that would be lost as a result of that shift is added onto the opposite side of the image.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
𝐀 = {'😀': 5} | |
for ℹ︎ in range(20): | |
# print(i, ℹ︎, i == ℹ︎) # NameError: name 'i' is not defined. | |
for _,__ in 𝐀.items(): | |
if __ == ℹ︎: | |
print(_, ℹ︎) | |
print(𝐀) # Prints dictionary in 𝐀 | |
print(A) # Also prints dictionary in 𝐀! | |
print(𝐀 is A) # True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IndexFormatter: | |
def __init__(self, volumeId: int): | |
self.itemPages = ( | |
ItemPage.objects.filter(volume__id=volumeId) | |
.order_by('item__topic__name', F('page') * 1, 'item__name')) | |
def format(self) -> str: | |
""" | |
Format the index for printing. | |
""" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
By Anmol Tomar on CodeX
Nov 29, 2022
Useful notes about using jq.
- Print all paths to values
jq -c paths
Prints each path as an array and doesn't show values.jq --stream 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' example.json
Nearly perfect. If each path shown began with.
and array indices were enclosed in square brackets, then each one would be a valid jq query string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -- | |
# Set timestamps of files in a cloned git repository to when they were last committed. | |
# Default: All git-controlled files in current directory, recursively | |
if [ ${#} = 0 ]; then | |
files="$(git ls-files -z | xargs -0 echo)" | |
else | |
files="${@}" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import os | |
from contextlib import closing | |
from botocore.exceptions import ClientError | |
def object_exists(s3, bucket, key): | |
try: | |
boto3.resource('s3').Object(bucket, key).load() | |
return True |
NewerOlder