author | date |
---|---|
Hajime Nakagami<nakagami@gmail.com> |
Sep 27, 2024 |
Do you use vim?
I have been using vi clone for over 30 years.
# sudo apt install imagemagick | |
# pip install matplotlib-backend-sixel matplotlib | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import numpy as np | |
matplotlib.use('module://matplotlib-backend-sixel') | |
def plot(): | |
x = np.linspace(0, 1) |
# https://qiita.com/bjam_ha_nai/items/609924c91343a12d6769 | |
# sudo apt install libsixel-bin libsixel-dev | |
# pip install libsixel-python matplotlib | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from libsixel.encoder import Encoder as SixelEncoder | |
from libsixel import SIXEL_OPTFLAG_WIDTH, SIXEL_OPTFLAG_HEIGHT | |
from tempfile import NamedTemporaryFile |
import xml.etree.ElementTree as ET | |
xml_data = '''<?xml version="1.0" encoding="utf-8"?> | |
<root> | |
<person id="1"> | |
<name>John Doe</name> | |
<age>30</age> | |
<city>Tokyo</city> | |
</person> | |
<person id="2"> |
import io | |
import zipfile | |
# Create and extract zip file example | |
# to file | |
with zipfile.ZipFile("test.zip", 'w') as z: | |
z.writestr('aaa/bbb/1.txt', b'aaa') | |
z.writestr('aaa/ccc/2.txt', b'ccc') | |
z.writestr('aaa/ccc/3.bin', b'\x00\x01\x02') |
import tkinter | |
root = tkinter.Tk() | |
root.geometry("600x400") | |
canvas = tkinter.Canvas(root, width=600, height=400, bg="white") | |
canvas.pack() | |
def event_handler(event): | |
print(event) | |
if event.type == tkinter.EventType.ButtonRelease: |
#!/usr/bin/env python | |
# Copyright (c) Twisted Matrix Laboratories. | |
# See LICENSE for details. | |
""" | |
An example of using Twisted with Tkinter. | |
Displays a frame with buttons that responds to mouse clicks. |
import pathlib | |
from typing import List | |
from PIL import Image | |
import streamlit as st | |
from tensorflow import keras | |
@st.cache_data | |
def download() -> str: |
Python mini Hack-a-thon Conference 2023-06-17 https://pyhack.connpass.com/event/282942/
100回を記念して、3年3ヶ月前に開催予定だった Python mini Hack-a-thon Conference での発表のために、 自分と Python と Python mini Hack-a-thon に関連した年表を作成した。
# Pelican https://pypi.org/project/pelican/ plugin that adjusts markdown | |
# YAML front matter created by Netlify CMS https://www.netlifycms.org/ et al. | |
# to be handled correctly as metadata in pelican. | |
# This plugin requires PyYAML https://pypi.org/project/PyYAML/ . | |
import io | |
import datetime | |
import yaml | |
from pelican import signals | |
from markdown import Markdown |