Skip to content

Instantly share code, notes, and snippets.

View xenodium's full-sized avatar
😸
[in Emacs]

xenodium

😸
[in Emacs]
View GitHub Profile
diff --git a/chatgpt-shell-google.el b/chatgpt-shell-google.el
index 2a97a9b..21665a2 100644
--- a/chatgpt-shell-google.el
+++ b/chatgpt-shell-google.el
@@ -50,7 +50,7 @@ If you use Gemini through a proxy service, change the URL base."
;; https://ai.google.dev/gemini-api/docs/tokens
;; A token is equivalent to _about_ 4 characters.
-(cl-defun chatgpt-shell-google-make-model (&key version short-version path token-width context-window)
+(cl-defun chatgpt-shell-google-make-model (&key version short-version path token-width context-window grounding-search)

ChatGPT(o1-preview)> I would like to restream #EmacsConf from Icecast video to a Youtube live stream for extra discoverability, but I'm having a hard time figuring out an ffmpeg command that I can run on my P52 without having the audio stutter. what is the correct ffmpeg incantation?

To restream an Icecast video stream to YouTube Live without audio stuttering on your ThinkPad P52, you can use the following ffmpeg command:

ffmpeg -re -i "INPUT_URL" \
  -use_wallclock_as_timestamps 1 \
  -c:v copy \
  -c:a aac -b:a 128k -ar 44100 \
  -af aresample=async=1 \
@xenodium
xenodium / expand-context-region.el
Last active September 17, 2024 08:56
Expand context region interactively
(defun expand-context-region ()
(interactive)
(let* ((buffer (current-buffer))
(saved-location (point))
(origin (save-excursion
(forward-line 0)
(point))))
(goto-char (line-beginning-position))
(set-mark (save-excursion
(forward-line 1)
@xenodium
xenodium / gist:6fbf669234e3f85991d8dbfb0e294fd1
Created August 16, 2024 12:26
Better ready-player icons for macOS
(setq ready-player-previous-icon "􀊉")
(setq ready-player-play-icon "􀊄")
(setq ready-player-next-icon "􀊋")
(setq ready-player-open-externally-icon "􀉐")
(setq ready-player-stop-icon "􀛷")
(setq ready-player-repeat-icon "􀊞")
(setq ready-player-shuffle-icon "􀊝")
(setq ready-player-autoplay-icon "􀋦")
@xenodium
xenodium / org2md.sh
Created January 28, 2024 12:31
Converting my org blog to markdown
$ pandoc -f org -t markdown-smart --strip-comments --wrap=none --lua-filter=org.lua index.org -o output.md && sed -i '' 's/{width="[0-9]*%"}//g' output.md
org.lua:
function Header(el)
el.attr = pandoc.Attr("", {}, {})
return el
end
function CodeBlock(el)
@xenodium
xenodium / extend-elisp-demos.el
Created January 12, 2024 09:39
Add own elisp-demos snippets
(defun advised:elisp-demos--search (orig-fun symbol)
(cl-letf* ((orig-insert-file-contents (symbol-function 'insert-file-contents))
((symbol-function 'insert-file-contents)
(lambda (filename &optional visit beg end replace)
(apply orig-insert-file-contents filename visit beg end replace nil)
(apply orig-insert-file-contents "/private/tmp/mine.org" visit beg end replace nil))))
(funcall orig-fun symbol)))
(advice-add 'elisp-demos--search :around #'advised:elisp-demos--search)
@xenodium
xenodium / send-to-kindle-as-txt.el
Last active September 16, 2023 19:36
Select text in an Emacs buffer and send with M-x send-to-kindle-as-txt
(defcustom send-to-kindle-from-email
nil
"Your own email address to send from via mu4e."
:type 'string
:group 'send-to-kindle)
(defcustom send-to-kindle-to-email
nil
"Your Kindle email address to send pdf to."
:type 'string
@xenodium
xenodium / send-to-kindle-as-pdf.el
Last active September 15, 2023 06:17
Select some text and invoke via M-x send-to-kindle-as-pdf
(defcustom send-to-kindle-from-email
nil
"Your own email address to send from via mu4e."
:type 'string
:group 'send-to-kindle)
(defcustom send-to-kindle-to-email
nil
"Your Kindle email address to send pdf to."
:type 'string
@xenodium
xenodium / eval-uncommented-region.el
Last active September 27, 2023 02:38
Eval commented out code
(defun ar/eval-uncommented-region (start end)
(interactive "r")
(let ((text (buffer-substring-no-properties start end)))
(with-temp-buffer
(insert text)
(emacs-lisp-mode)
(uncomment-region (point-min) (point-max))
(eval-buffer)
(message "Evaluated"))))
@xenodium
xenodium / dwim-shell-commands.el
Created July 15, 2023 16:05
dwim-shell-commands-duplicate tramp experiment
(defun dwim-shell-commands-duplicate ()
(interactive)
(dwim-shell-command-on-marked-files
"Duplicate file(s)."
"cp '<<f>>' '<<f(u)>>'"
:utils '("cp" "scp")
:post-process-template
(lambda (script file)
(if (tramp-tramp-file-p file)
;; Tramp file path start with "/ssh:". Drop it.