Skip to content

Instantly share code, notes, and snippets.

View antifuchs's full-sized avatar
🕴️

Andreas Fuchs antifuchs

🕴️
View GitHub Profile
@antifuchs
antifuchs / asf-rustdoc-edit.el
Last active January 17, 2020 02:44
This sets up a key binding for C-c ' in rust-mode, which acts very similarly to org-src's key binding, except the other direction: If you use it on a rustdoc comment, it'll open another buffer with the comment in it, in markdown-mode.
;;; Copyright (C) 2018, 2019 Andreas Fuchs <asf@boinkor.net>
;;; Made available to you under the terms of GPLv2 or later: https://choosealicense.com/licenses/gpl-2.0/
(use-package edit-indirect
:straight t)
(defconst asf--rustdoc-line-prefixes (concat "^\\([\t ]*" (regexp-opt '("///" "//!")) "\\)"))
(defun asf--rustdoc-current-comment-block-region ()
(save-excursion
-*- mode: cargo-process; default-directory: "~/Hacks/fibonacci_codec/" -*-
Cargo-Process started at Sat Sep 15 20:08:25
/Users/asf/.cargo/bin/cargo test --manifest-path /Users/asf/Hacks/fibonacci_codec/Cargo.toml
Compiling fibonacci_codec v0.1.2-dev (file:///Users/asf/Hacks/fibonacci_codec)
warning: unused import: `fib_decode_u64`
--> tests/decode.rs:7:23
|
7 | use fibonacci_codec::{fib_decode_u64, fib_decode_u8, DecodeError, Encode};
| ^^^^^^^^^^^^^^

Keybase proof

I hereby claim:

  • I am antifuchs on github.
  • I am asf (https://keybase.io/asf) on keybase.
  • I have a public key ASBUHxa7gvyTT8vgVApa2Hby_B6ilHJhq92qZ9bLewQ20wo

To claim this, I am signing this object:

@antifuchs
antifuchs / text-search.lisp
Created November 19, 2017 17:43
This is the source code to the text-search visualizer I wrote about in https://boinkor.net/2007/03/simple-visualization-tool-for-string-search; it comes with a McCLIM GUI that (when I wrote it, in 2007) allowed seeing what steps were taken and which characters were visited. Hope this is still useful...
;;; written 2007-03-15 and -16
;;; by Andreas Fuchs <asf@boinkor.net>
;;; MIT licence.
(cl:eval-when (:compile-toplevel :load-toplevel :execute)
(cl:require :mcclim))
(cl:defpackage :my-favourite-algorithm.text-search
(:use :clim-lisp :clim))

What

errcheck intentionally warns on defer statements, but sadly a lot of idiomatic code uses un-checked defer calls, e.g.

	resp, err := httpClient.PostForm(ts.URL+"/login/", params)
	if err != nil {
		t.Fatal(err)
	}
	defer resp.Body.Close() // This is not a thing you should need to error-check!
<html>
<body>
<script type="application/javascript">
foo = { "bar": "</script>" };<script>alert("hi"); "}
</script>
</body>
</html>
Zulip-Desktop@0.4.2 /Users/asf/Hacks/zulip-electron
├─┬ assert@1.4.1
│ └─┬ util@0.10.3
│ └── inherits@2.0.1
├─┬ configstore@2.1.0
│ ├─┬ dot-prop@3.0.0
│ │ └── is-obj@1.0.1
│ ├── graceful-fs@4.1.9
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
This file has been truncated, but you can view the full file.
/.DS_Store
/.editorconfig
/.gitattributes
/.gitignore
/.travis.yml
/app
/app/main
/app/main/domain.js
/app/main/index.js
/app/main/link-helper.js
rustup run nightly cargo install clippy
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling rustc-serialize v0.3.19
Compiling matches v0.1.2
Compiling regex-syntax v0.3.4
Compiling nom v1.2.4
Compiling unicode-normalization v0.1.2
Compiling quine-mc_cluskey v0.2.4
Compiling semver v0.2.3
Compiling toml v0.1.30
$ cargo run 60
Compiling chars v0.1.0 (file:///Users/asf/Hacks/chars)
Running `target/debug/chars 60`
< = LESS-THAN SIGN, 60, 0x3c, 074, bits 111100: prints as <
` = GRAVE ACCENT, 96, 0x60, 0140, bits 1100000: prints as `
0 = DIGIT ZERO, 48, 0x30, 060, bits 110000: prints as 0