Skip to content

Instantly share code, notes, and snippets.

@yuttie
yuttie / Dockerfile
Last active November 15, 2022 02:42
Build Python 3.8 environment with poetry for M1 macOS
FROM --platform=linux/amd64 amd64/python:3.8-bullseye
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /work
ADD pyproject.toml poetry.lock /work/
RUN poetry install
VOLUME /work
ENTRYPOINT poetry run jupyter notebook --allow-root --ip=0.0.0.0 --port=3333 --no-browser
@yuttie
yuttie / push-line.fish
Last active August 7, 2021 07:37 — forked from turanegaku/push-line.fish
A fish shell function to emulate zsh's buffer stack, i.e. store the current command and run one in between - restore the last command afterwards
# Save this file to ~/.config/fish/functions/push-line.fish
# Bind the function by using this in ~/.config/fish/functions/fish_user_key_bindings.fish
# function fish_user_key_bindings
# # For example alt+q
# bind \eq push-line
# end
function push-line
# Add an event handler for fish_postexec
@yuttie
yuttie / no-month-year-units.js
Last active July 15, 2021 13:30
Don't use 'months' and 'years' units (up to 'days') in relative times with Day.js
dayjs.extend(relativeTime, {
thresholds: [
{ l: 's', r: 1 },
{ l: 'm', r: 1 },
{ l: 'mm', r: 59, d: 'minute' },
{ l: 'h', r: 1 },
{ l: 'hh', r: 23, d: 'hour' },
{ l: 'd', r: 1 },
{ l: 'dd', d: 'day' },
{ l: 'M' },
import csv
from io import TextIOWrapper
from urllib.request import urlopen
with urlopen('https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv') as f:
if f.status == 200:
for row in csv.DictReader(TextIOWrapper(f, encoding='cp932', newline='')):
print(row)
else:
raise 'Something was wrong'

This is a test

これはテストです。

さあ どう でしょう\

か?

"あいうえお"12345

@yuttie
yuttie / fonts.conf
Created September 25, 2019 16:07
Configuration of fontconfig to use heavier weights of Iosevka font.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Use heavier weights -->
<match target="pattern">
<test name="family"><string>Iosevka</string></test>
<test name="weight" compare="eq"><const>regular</const></test>
<edit name="weight" mode="assign" binding="strong"><const>semibold</const></edit>
</match>
<match target="pattern">
@yuttie
yuttie / Hiragino.xml
Last active May 30, 2019 05:14
Hiragino font theme for PowerPoint 2016 for Mac. Putting the XML file under `/Applications/Microsoft PowerPoint.app/Contents/Resources/Office Themes/Theme Fonts/`, you will see a new entry in the font selector menu of the "master slide" panel. This work is based on http://www.brandwares.com/bestpractices/2015/10/xml-hacking-font-themes/. See also
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<a:fontScheme name="Hiragino" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:majorFont>
<a:latin typeface="ヒラギノ角ゴシック W6" />
<a:ea typeface="" />
<a:cs typeface="" />
<a:font script="Jpan" typeface="ヒラギノ角ゴシック W6"/>
</a:majorFont>
<a:minorFont>
<a:latin typeface="ヒラギノ角ゴシック W2" />
@yuttie
yuttie / config-5.0.16-gentoo.patch
Last active May 18, 2019 11:14
A patch of Linux kernel config that made console available again with NVIDIA's proprietary driver. Those changes were made according to https://wiki.gentoo.org/index.php?title=NVIDIA/nvidia-drivers&oldid=798107 . (Note that this is not a minimalistic patch to this end though.)
--- /boot/config-5.0.16-gentoo-no-console 2019-05-18 12:57:52.000000000 +0900
+++ /boot/config-5.0.16-gentoo 2019-05-18 18:18:10.000000000 +0900
@@ -484,6 +484,7 @@
CONFIG_ACPI_PROCESSOR_IDLE=y
CONFIG_ACPI_CPPC_LIB=y
CONFIG_ACPI_PROCESSOR=y
+# CONFIG_ACPI_IPMI is not set
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_PROCESSOR_AGGREGATOR=m
CONFIG_ACPI_THERMAL=m
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yuttie
yuttie / firefox-stylish-force-toolbar-in-fullscreen.css
Created May 3, 2017 16:21
Stylish script for Firefox to force toolbars to appear in fullscreen mode.
@-moz-document url(chrome://browser/content/browser.xul) {
/* Force toolbars to appear in fullscreen mode. */
#main-window[inFullscreen][inDOMFullscreen] #navigator-toolbox,
#main-window[inFullscreen][inDOMFullscreen] #fullscr-toggler,
#main-window[inFullscreen][inDOMFullscreen] #sidebar-box,
#main-window[inFullscreen][inDOMFullscreen] #sidebar-splitter,
#main-window[inFullscreen]:not([OSXLionFullscreen]) toolbar:not([fullscreentoolbar=true]),
#main-window[inFullscreen] #global-notificationbox,
#main-window[inFullscreen] #high-priority-global-notificationbox {
visibility: initial !important;