Skip to content

Instantly share code, notes, and snippets.

@alphaho
alphaho / README
Created March 29, 2025 13:37 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@alphaho
alphaho / markdown-details-collapsible.md
Created May 20, 2024 10:30 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@alphaho
alphaho / InSpringConfig.kt
Created November 13, 2019 12:47
integrate http4k into Spring application
@Bean
fun http4kServletRegistrationBean(): ServletRegistrationBean<HttpHandlerServlet> {
val app = routes("/webapi/hello" bind GET to { request: Request ->
Response(OK).body("Hello!")
})
val servlet = app.asServlet()
return ServletRegistrationBean<HttpHandlerServlet>(servlet, "/webapi/*")
}
@alphaho
alphaho / gist:6925024
Last active December 25, 2015 05:29
ergoemacs-debug output for ergoemacs-mode issue #105.
================================================================================
Ergoemacs-mode is turning ON.
Time Since Start ergoemacs-mode: 0.000029 sec
Time Since Last Heading: 0.000046 sec
================================================================================
================================================================================
Update variables and modes
Time Since Start ergoemacs-mode: 0.000082 sec
Time Since Last Heading: 0.000031 sec
@alphaho
alphaho / backtrace
Created December 4, 2012 14:16
ein Unsupported websocket protocol backtrace with ein-08513c37bf
This file has been truncated, but you can view the full file.
Debugger entered--Lisp error: (error "Failed to start kernel. No `kernel_id' or `ws_url'. Got nil.")
signal(error ("Failed to start kernel. No `kernel_id' or `ws_url'. Got nil."))
error("Failed to start kernel. No `kernel_id' or `ws_url'. Got %S." nil)
(if (and kernel_id ws_url) nil (error "Failed to start kernel. No `kernel_id' or `ws_url'. Got %S." data))
(unless (and kernel_id ws_url) (error "Failed to start kernel. No `kernel_id' or `ws_url'. Got %S." data))
(let* ((--cl-rest-- data) (kernel_id (car (cdr (memq (quote :kernel_id) --cl-rest--)))) (ws_url (car (cdr (memq (quote :ws_url) --cl-rest--))))) (unless (and kernel_id ws_url) (error "Failed to start kernel. No `kernel_id' or `ws_url'. Got %S." data)) (ein:log (quote info) "Kernel started: %s" kernel_id) (setf (ein:$kernel-running kernel) t) (setf (ein:$kernel-kernel-id kernel) kernel_id) (setf (ein:$kernel-ws-url kernel) ws_url) (setf (ein:$kernel-kernel-url kernel) (concat (ein:$kernel-base-url kernel) "/" kernel_id)))
(progn
@alphaho
alphaho / Unsupported websocket protocol backtrace
Created December 3, 2012 14:32
ein Unsupported websocket protocol backtrace
Debugger entered--Lisp error: (websocket-unsupported-protocol)
signal(websocket-unsupported-protocol nil)
websocket-open("/kernels//shell" :on-open (lambda ... ...) :on-message (lambda ... ...) :on-close (lambda ... ...))
(let ... ... ... websocket)
ein:websocket("/kernels//shell")
(let ... ...)
(let* ... ...)
(setf ... ...)
(let* ... ... ... ... ... ...)
ein:kernel-start-channels([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] nil nil nil "/kernels" "/kernels/" nil t "username" "e6d433ed-7f7b-4879-88b2-12403cd7fc10" #s(hash-table size 65 test equal rehash-size 1.5 rehas