Skip to content

Instantly share code, notes, and snippets.

@amno1
amno1 / tail.el
Last active October 8, 2024 06:52
Tail & Head implementation in Emacs Lisp
Print the last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
Mandatory arguments to long options are mandatory for short options too.
-c, --bytes=[+]NUM output the last NUM bytes; or use -c +NUM to
output starting with byte NUM of each file
-f, --follow[={name|descriptor}]
output appended data as the file grows;
an absent option argument means 'descriptor'
-F same as --follow=name --retry
@amno1
amno1 / sleepy-cat.el
Last active July 3, 2024 21:13
Ascii cat
;;; sleepy-cat.el --- Animate an ascii cat in Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2024 Arthur Miller
;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; no consing one iteration
(defun rotatel (list)
(let ((new (cdr list)))
(setf (cdr list) nil)
(setf new (nconc new list))))
;; no consing two iterations
(defun rotatel (list)
(let ((first (pop list))
(rlist (nreverse list)))
@amno1
amno1 / aoc-helper.el
Last active December 4, 2023 23:56
Small utility to generate an empty skeleton file for solving AoC puzzles
;;; aoc-helper.el --- Gen AOC skeleton -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Arthur Miller
;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@amno1
amno1 / org-capture-complete.el
Last active October 9, 2023 15:05
Two different ideas for org-capture via completing read
;;; org-capture-complete.el --- Two different ideas for org-capture via completing read -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Arthur Miller
;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords: tools, lisp
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@amno1
amno1 / shell-command-with-aliases.el
Last active November 4, 2023 19:09
Use Bash aliases in interactive shell-comands
;;; shell-command-with-aliases.el --- Use Bash aliases in interactive shell-comands -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Arthur Miller
;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@amno1
amno1 / Emacs-logo-ukr.svg
Last active January 13, 2023 13:04
Emacs Logo UKR
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amno1
amno1 / build-emacs.el
Last active December 8, 2023 04:59
Build Custom Emacs from Git from Emacs
;;; build-emacs.el --- Build custom Emacs from sources -*- lexical-binding: t; -*-
;; Copyright (C) 2022 Arthur Miller
;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords: tools
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@amno1
amno1 / Set up GitHub push with SSH keys.md
Created August 17, 2021 02:10 — forked from xirixiz/Set up GitHub push with SSH keys.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@amno1
amno1 / Toolbar.el
Created May 17, 2021 10:10 — forked from rougier/Toolbar.el
Emacs SVG Toolbar
;; An experiment for an SVG toolbar using icons from material.io
;;
;; Example usage: (toolbar 48 "black" "white" t t)
;; Material icons freely available (Apache 2 license) from
;; - https://material.io/resources/icons/?style=outline
;; - https://github.com/google/material-design-icons
(require 'xml) (require 'svg)
(defun toobar-item (label icon fg-color bg-color size with-icon with-label)