All sizes in MB, change /1024/1024
to /1024/1024/1024
for GB.
Without system databases
select
datname as database,
(pg_database_size(datname)/1024/1024) as size
If you are using APFS Case Sensitive File system and trying to use Steam, it will flicker & silently fail or show the following error message:
steam requires that '~/library/application support/steam/steam.appbundle/steam/contents/macos' be on a case-insensitive filesystem.
To fix the issue, follow the instruction here.
// Tracking cursor position in real-time without JavaScript | |
// Demo: https://twitter.com/davywtf/status/1124146339259002881 | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
"strings" | |
) |
In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.
One of the symptoms of such corruptions is the following message:
ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678
This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.
""" | |
Given a dictionary, transform it to a string. Then byte encode that string. Then base64 encode it and since this will go | |
on a url, use the urlsafe version. Then decode the byte string so that it can be else where. | |
""" | |
data = base64.urlsafe_b64encode(json.dumps({'a': 123}).encode()).decode() | |
# And the decode is just as simple... | |
data = json.loads(base64.urlsafe_b64decode(query_param.encode()).decode()) | |
# Byte encode the string, base64 decode that, then byte decode, finally transform it to a dictionary |
import serial | |
from serial.tools import miniterm | |
import subprocess, sys, re, os | |
class ESPMiniterm(miniterm.Miniterm): | |
def handle_menu_key(self, c): | |
if c == '\x15': # ctrl-u | |
self.upload_file() | |
else: | |
super(ESPMiniterm, self).handle_menu_key(c) |
"""A program that encodes and decodes hidden messages in images through LSB steganography""" | |
from PIL import Image, ImageFont, ImageDraw | |
import textwrap | |
def decode_image(file_location="images/encoded_sample.png"): | |
"""Decodes the hidden message in an image | |
file_location: the location of the image file to decode. By default is the provided encoded image in the images folder | |
""" | |
encoded_image = Image.open(file_location) |