View init-webpaste.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package webpaste | |
:ensure t | |
:bind (("C-c C-p C-b" . webpaste-paste-buffer) | |
("C-c C-p C-r" . webpaste-paste-region) | |
("C-c C-p C-p" . webpaste-paste-buffer-or-region)) | |
:config | |
;; we can't use github gists, because the creation API requires a token in the header | |
;; see https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#create-a-gist | |
;; and open PR: https://github.com/etu/webpaste.el/pull/57 | |
;; - dpaste.org fast, with (auto?) syntax highlighting, but dark mode |
View init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; minimal version of my Emacs setup which approximates the effective points per inch on your screen | |
;; and then selects your default font pts based on that | |
;; Also works on wayland / WSLg because it parses out physical dims from weston.log (necessary in 2023-01) | |
;; LIMITATION: Will probably not work on multi-monitor setups. Exercise for the reader! | |
;; BSD 3-clause copyright Charl P. Botha <info@charlbotha.com> | |
(defun get-mon-attr (which) | |
(cdr (assoc which (car (display-monitor-attributes-list))))) | |
(defun get-monitor-width-mm () |
View mastodon-init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package mastodon | |
:ensure t | |
:config | |
;; I am @cpbotha@emacs.ch on Mastodon which translates to: | |
(setq mastodon-instance-url "https://emacs.ch") | |
(setq mastodon-active-user "cpbotha")) |
View init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; as of 2021-12-19 with latest master pgtk emacs on non-store WSL I can copy | |
;; text from other apps into Emacs, but I can't copy text from Emacs into other | |
;; apps, and so I use this work-around with wl-copy. | |
;; original value of interprogram-cut-function was gui-select-text. | |
;; you need to have the wl-clipboard package installed for the wl-copy tool. | |
;; update 2022-01-28: this work-around still required with WSL 0.51.2.0 | |
(when (getenv "WAYLAND_DISPLAY") | |
(setq | |
interprogram-cut-function | |
(lambda (text) |
View libgccjit.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# three changes by Charl Botha https://github.com/cpbotha to get this building | |
# on the M1 | |
# 1. use the iains branch of gcc (see head spec) | |
# 2. change build config to "--build=aarch64-apple-darwin#{osmajor}" | |
# 3. remove --with-bugurl | |
# then build with: | |
# brew install --verbose --build-from-source -head --formula ./libgccjit.rb | |
# took about 18 minutes on my M1 MBA |
View pyproject.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.poetry] | |
name = "stream-manager" | |
version = "0.0.147" | |
description = "" | |
authors = ["David Weber <david.weber@stonethree.com>", "Janto Dreijer janto.dreijer@stonethree.com"] | |
license = "Proprietary" | |
packages = [ | |
{ include = "server" } | |
] |
View lapingvino_zig_example.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# two nim-lang solutions based on this reddit thread: | |
# https://old.reddit.com/r/Zig/comments/k9q0vi/append_to_slice_in_zig/ | |
# and this gist: | |
# https://gist.github.com/LaPingvino/57fb1c0afaacdb1185f247db2b365102 | |
# -- Charl P. Botha <https://charlbotha.com/> | |
# on this Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz I get: | |
# with nim 1.4.2 and nim c --gc:orc -d:release: | |
# {500000002, 2} |
View guessing_game.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# guess a number inspired by togglebit! https://www.twitch.tv/togglebit | |
# this nim version by nim n00b Charl P. Botha https://charlbotha.com/ | |
# if I build this with nim 1.4 on ubuntu 20.04 with: | |
# nim c -d:release --opt:size guessing_game.nim | |
# the resultant binary is 62 kBytes | |
import random, strutils | |
# init random seed | |
randomize() |
View figure.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{/* | |
figure with auto-resizing and srcset v2020-05-10 | |
Drop-in replacement for Hugo's figure shortcode as of 2020-05-02 that uses img srcset | |
to enable browsers to download only the resolution that they need. | |
The resizing and srcset magic only works for images that are part of the page | |
bundle. It will fall back to stock Hugo figure behaviour otherwise. |
View archive-extract-to-file.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://emacs.stackexchange.com/a/3843/8743 original code | |
;; cpbotha.net made small improvements to ergonomics | |
;; cpbotha changes: | |
;; - by default extract files WITHOUT their relative directories into DIR, | |
;; because that's what I expect in OFMs. | |
(defun archive-extract-to-file (archive-name item-name command dir keep-relpath) | |
"Extract ITEM-NAME from ARCHIVE-NAME using COMMAND. Save to | |
DIR. If KEEP-RELPATH, extract with relative path otherwise don't." | |
(unwind-protect |
NewerOlder