Skip to content

Instantly share code, notes, and snippets.

View elderica's full-sized avatar
🚞
I'm enjoing with trains and computers.

elderica

🚞
I'm enjoing with trains and computers.
View GitHub Profile
@elderica
elderica / bin2hex
Created August 5, 2023 04:29
awkbin
#!/bin/sh
export LANG=C LC_ALL=C
LF=$(printf '\\\n_'); LF=${LF%_}
od -A n -t x1 -v |
tr -Cd '0123456789accdefABCDEF\n' |
tr 'abcdef' 'ABCDEF' |
sed "s/../&$LF/g" |
grep -v '^$'
@elderica
elderica / download_bing_wallpapers.sh
Last active August 22, 2024 11:25
Download wallpapers from Bing. This script depends curl and jq.
#!/bin/sh
### Usage:
### $ env RESOLUTION=UHD NDAYSAGO=1 SAVETO=$HOME/Bing sh download_bing_wallpaper.sh
set -euo pipefail
RESOLUTION=${RESOLUTION:-1920x1080} # Possible values: 1920x1080, 1366x768, UHD
NDAYSAGO=${NDAYSAGO:-0}
@elderica
elderica / Dockerfile.archlinux
Created July 23, 2023 13:35
SBCL on Arch Linux with Docker
FROM archlinux:latest AS base
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
# Install runtime dependencies
RUN pacman -Syu --noconfirm zstd
FROM base AS sbcl-builder
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
@elderica
elderica / Dockerfile.archlinux
Created July 23, 2023 13:18
SBCL on ArchLinux with Docker
FROM archlinux:latest AS base
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
# Install runtime dependencies
RUN pacman -Syu --noconfirm zstd
FROM base AS sbcl-builder
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
FROM archlinux:latest AS base
# Install runtime dependencies
RUN set -x \
&& pacman -Syu --noconfirm zstd
FROM base AS sbcl-builder
ENV SBCL_VERSION=2.3.6
ENV SBCL_PREFIX=/opt/sbcl
@elderica
elderica / Dockerfile.archlinux
Created July 23, 2023 09:40
SBCL on Archlinux
FROM archlinux:latest AS base
ARG SBCL_VERSION=2.3.6
ENV SBCL_SIGNING_KEY=D6839CA0A67F74D9DFB70922EBD595A9100D63CD
ENV SBCL_DOWNLOADS_BASE_URL="https://downloads.sourceforge.net/project/sbcl/sbcl"
ENV SBCL_HASH_FILE=sbcl-${SBCL_VERSION}-crhodes.asc
ENV SBCL_HASH_URL=${SBCL_DOWNLOADS_BASE_URL}/${SBCL_VERSION}/${SBCL_HASH_FILE}
@elderica
elderica / Dockerfile.archlinux
Created July 23, 2023 09:08
SBCL 2.3.6 on ArchLinux
FROM archlinux:latest AS base
ARG SBCL_VERSION=2.3.6
ENV SBCL_SIGNING_KEY=D6839CA0A67F74D9DFB70922EBD595A9100D63CD
ENV SBCL_DOWNLOADS_BASE_URL="https://downloads.sourceforge.net/project/sbcl/sbcl"
ENV SBCL_HASH_FILE=sbcl-${SBCL_VERSION}-crhodes.asc
ENV SBCL_HASH_URL=${SBCL_DOWNLOADS_BASE_URL}/${SBCL_VERSION}/${SBCL_HASH_FILE}
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
@elderica
elderica / plotting.lisp
Created June 4, 2023 07:56
reimplement plotting.py
;;;; This is reimplementation of `plotting.py` from "Coding the Matrix"
;;;; and contains a simple plotting interface, which uses a browser with SVG to
;;;; present a plot of points represented as either complex numbers or 2-vectors.
;;;;
;;;; First you need evaluate following expressions then load this file.
;;;; ```
;;;; (require "asdf")
;;;; (asdf:load-system "uiop")
;;;; ```
(in-package :cl-user)
#!/bin/bash
set -eux
player_hand=$(
zenity --list \
--title "あなたの手は?" \
--column="手" \
"グー" \
"チョキ" \
"パー"