Skip to content

Instantly share code, notes, and snippets.

@MasWag
MasWag / ruby.org
Created July 12, 2024 22:23
ruby with org-mode

@@latex:\ruby{@@遠き神@@latex:}{、|、|、}@@

@MasWag
MasWag / add2_dynamic_binding.el
Last active July 4, 2024 11:48
A counterintuitive(?) behavior of dynamic binding demonstrated with Emacs Lisp
;; Static Binding
(setq lexical-binding t)
t
(defun addx (x)
(lambda (y) (+ x y)))
addx
(let ((add10 (addx 10))
(x 3))
(funcall add10 5)) ;; 10 + 5 = 15
15
@MasWag
MasWag / config-satysfi-ts-mode.el
Created February 28, 2024 06:18
A small configuration of satysfi-ts-mode + lsp-mode
(require 'package)
;;;; Add package-archives
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; Initialize
(package-initialize)
(require 'leaf)
(leaf satysfi-ts-mode
@MasWag
MasWag / copy-mastodon-uris-as-kill.el
Created February 23, 2024 04:14
Extract and copy Mastodon URIs to kill-ring
;;; copy-mastodon-uris-as-kill.el --- Extract and copy Mastodon URIs to kill-ring -*- lexical-binding:t -*-
;; Copyright (C) 2024 Masaki Waga
;; Maintainer: Masaki Waga
;; Keywords: Mastodon, social, kill-ring
;; This file is NOT a part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; I use Ellama (https://github.com/s-kostyaev/ellama/) to streamline my interactions with LLM. Here's the configuration:
;;
;; Since Ellama relies on ollama (https://ollama.ai/) and its zephyr library (https://ollama.ai/library/zephyr) by default, you need to configure it externally. After downloading ollama, you can obtain zephyr with `ollama pull zephyr`.
(leaf ellama
:ensure t
:require t
:custom
;; I use C-c , as the prefix of ollama
(ellama-keymap-prefix . "C-c ,")
@MasWag
MasWag / PKGBUILD
Created February 12, 2024 00:46
PKGBUILD for robodoc 4.99.44 with -Wno-error=format-security
# Maintainer: Geballin - Guillaume Ballin <macniaque at free dot fr>
pkgname=robodoc
pkgver=4.99.44
pkgrel=1
pkgdesc="ROBODoc is program documentation tool. It works with many programming languages: For instance C, Pascal, Shell Scripts, Assembler, COBOL, Occam, Postscript, Forth, Tcl/Tk, C++, Java -- basically any program in which you can use remarks/comments."
url="https://rfsber.home.xs4all.nl/Robo/"
arch=('x86_64' 'i686')
license=('GPLv3')
depends=()
optdepends=()
@MasWag
MasWag / run-ansible-playbook.el
Last active February 27, 2024 03:59
Run ansible-playbook with C-c C-c
(require 'leaf)
;; Define a customizable variable for the inventory file
(defcustom ansible-inventory-file "hosts"
"The default inventory file for ansible-playbook commands."
:type 'string
:group 'user)
(defcustom ansible-connection-password-file nil
"The file containing the password for the connection."
@MasWag
MasWag / make-audio-feed.sh
Created February 3, 2024 13:18 — forked from ivan/make-audio-feed.sh
Script to generate a Podcasts/Overcast-compatible RSS feed for audio files on your own web server
#!/usr/bin/env bash
# Generates an RSS feed for a list of audio files, for consumption by Overcast
# and other podcast players.
#
# Usage: make-audio-feed TITLE BASE_URL FILE...
# Example: (cd directory && make-audio-feed 'My Audio Files' 'https://your.server/directory/' * > .feed.rss)
set -eu -o pipefail
@MasWag
MasWag / PKGBUILD
Last active January 11, 2024 05:06
PKGBUILD for Microsoft SEAL 4.1.1
# Maintainer: Masaki Waga <masakiwaga@gmail.com>
# Maintainer: Alex J. Malozemoff <amaloz@galois.com>
# Maintainer: Benjamin Cheng <ben@bcheng.me>
pkgname=sealcrypto
pkgver=4.1.1
pkgrel=1
pkgdesc='Microsoft library for fully homomorphic encryption'
arch=('x86_64')
url="https://www.microsoft.com/en-us/research/group/cryptography-research/"
license=('MIT')
@MasWag
MasWag / build_exim4_deb_with_arc.sh
Last active January 5, 2024 08:58
Script to build Exim with ARC support in a Debian Docker container
#!/bin/bash -ue
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,