Skip to content

Instantly share code, notes, and snippets.

@Gavinok
Gavinok / list-gists.el
Created December 18, 2022 23:31
list gists easily using the gh cli client
(defun lists-gists ()
(interactive)
(call-process "gh" nil "*Gists*" nil "gist" "list"))
@Gavinok
Gavinok / gist-from-region-v2.el
Created December 18, 2022 23:27
Create a gist from a given region interactively. Depends on the `gh` command line interface. Now Async
(defun gist-from-region (BEG END fname desc &optional private)
"Collect the current region creating a github gist with the
filename FNAME and description DESC.
If the opitonal argument PRIVATE is non-nil then the gist will be
made private. Otherwise the gist will be default to public"
(interactive (list (mark) (point)
(read-string "File Name: ")
(read-string "Description: ")
current-prefix-arg))
(let ((proc (make-process :name "Gist Creation"
@Gavinok
Gavinok / gist-from-region.el
Last active December 18, 2022 22:19
Create a gist from a given region interactively. Depends on the `gh` command line interface
(defun gist-from-region (BEG END fname desc &optional private)
"Collect the current region creating a github gist with the
filename FNAME and description DESC.
If the opitonal argument PRIVATE is non-nil then the gist will be
made private. Otherwise the gist will be default to public"
(interactive (list (mark) (point)
(read-string "File Name: ")
(read-string "Description: ")
current-prefix-arg))
@Gavinok
Gavinok / AOC-d1.el
Created December 15, 2022 00:23
Emacs lisp solution for day one of advent of code 2022
(defun cals-per-elf ()
(with-temp-buffer
(progn (insert "((")
(insert-file-contents "~/res.txt")
(while (re-search-forward "^$" nil t)
(replace-match ")(" nil nil))
(end-of-buffer)(insert "))")
(goto-char 0))
(mapcar (lambda (food-carried)
(cl-reduce #'+ food-carried))
@Gavinok
Gavinok / chatgpt.el
Last active June 4, 2023 22:22
chatgpt client for emacs WIP (Now Async!)
;;; chatgpt.el --- Simple ChatGPT frontend for Emacs -*- lexical-binding: t -*-
;; Copyright (C) Gavin Jaeger-Freeborn
;; This package 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, or (at your option)
;; any later version.
;; This package is distributed in the hope that it will be useful,
@Gavinok
Gavinok / aoc-day7.lisp
Last active December 9, 2022 01:22
My overly verbose lisp version of AOC day 7
(ql:quickload :arrows)
(defpackage aoc-day-7
(:use :cl)
(:import-from :arrows
:->
:->>
:-<>))
(in-package :aoc-day-7)
(declaim (optimize (safety 3) (debug 3)))
@Gavinok
Gavinok / monad.ts
Last active December 3, 2022 04:25
failed attempt at monad examples in typescript
interface Monad<Type> {
m: Type;
}
interface MonadInterface<Type1, Type2> {
bind: (a: Monad<Type1>, z: (a: Type1) => Monad<Type2>) => Monad<Type2>;
sequence: (a: Monad<Type1>, b: Monad<Type2>) => Monad<Type2>;
pure: (a: Type1) => Monad<Type1>;
}
@Gavinok
Gavinok / README.org
Created August 14, 2022 16:16
Learning Emacs Lisp (Functions, Lists, and Homoiconicity

POSTED Emacs Lisp Everything You NEED To Know

@Gavinok
Gavinok / valgrind.md
Created August 2, 2022 19:51
valgrind clamping benchmark

Valgrind clamping comparison

Before clamping

#define CLAMP(X) ((X > 0) ? X : 0)
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>