Skip to content

Instantly share code, notes, and snippets.

View antifuchs's full-sized avatar
🕴️

Andreas Fuchs antifuchs

🕴️
View GitHub Profile
FROM ubuntu:latest
ENV CONTAINER_NAME=foobar
# This is fairly silly, but does print the $CONTAINER_NAME env var
# such that tmux windows pick it up:
CMD printf '\033k%s\033\' $CONTAINER_NAME ; exec bash
// An iterator over the File descriptors contained in an FD ring buffer
pub struct RingIter<'a> {
ring: &'a Ring,
offset: u64,
}
impl Iterator for RingIter<'a> {
type Item = RawFd;
fn next(&'a mut self) -> Option<RawFd> {
@antifuchs
antifuchs / private.xml
Created January 27, 2016 21:17
Put this in `Library/Application Support/Karabiner/private.xml`
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>APPLE_INC</vendorname>
<vendorid>0x05ac</vendorid>
</devicevendordef>
<devicevendordef>
<vendorname>FILCO</vendorname>
<vendorid>0x04d9</vendorid>
////// Easily customizable stuff
// Step zero: have a filter that sorts all [email protected] mail into _github_incoming & archives it
var incomingLabel = '_github_incoming'; // You can hide this in the sidebar.
// github sends to "me", and I want less of that pollution
var toMeLabel = 'asf';
// labels for various conditions:
var meLabel = 'github';
var teamMentionLabel = 'github/team_mention';
///// End of the easily customizable stuff

Re-use buffers across visible frames

By default, popwin pops up a window in the current frame only. This is fine, but if I have a multi-monitor setup, I want the secondary monitor to have these secondary buffers (e.g. test or grep output, magit).

Using display-buffer-alist, I can activate popwin only when the buffer isn’t already there. I hope this doesn’t break other stuff!

(setq display-buffer-alist
;;; written 2007-03-15 and -16
;;; by Andreas Fuchs <[email protected]>
;;; MIT licence.
(cl:eval-when (:compile-toplevel :load-toplevel :execute)
(cl:require :mcclim))
(cl:defpackage :my-favourite-algorithm.text-search
(:use :clim-lisp :clim))

Andreas' no-fail pasta sauce recipe

This is by no means an authentic recipe. It has worked very well for me, though! So enjoy.

Ingredients

Serves 2-3 people

  • 1 Onion, finely chopped
  • 1 can of diced tomatoes (make sure there are no spices in there)
@antifuchs
antifuchs / iterm2_zsh_init.zsh
Last active July 19, 2024 07:47
tmux-enabled iterm2 shell integration for zsh.
if [[ -o login ]]; then
TMUX_PREFIX=""
if [[ ! -z "$TMUX" ]] ; then
# Via
# <http://blog.yjl.im/2014/12/passing-escape-codes-for-changing-font.html>:
TMUX_PREFIX='\ePtmux;\e'
TMUX_POSTFIX='\e\\'
fi
# Indicates start of command output. Runs just before command executes.

Flip “b c” and “b B” to do the opposite of each other

(which is what I expect them to do, finger-memorily)

(defun asf--set-magit-action (popup action-name new-key)
  (let* ((actions (plist-get popup :actions))
         (action-defn (-find (lambda (elt) (eq (caddr elt) action-name)) actions))
         (existing-action (assoc new-key actions)))
;;    (assert (null existing-action) "Not a great idea to set this to an existing key")
;;    (assert (not (null action-defn)) "Couldn't find action %s in %s" action-name actions)
@antifuchs
antifuchs / config.org
Last active August 29, 2015 14:22
This is the filladapt mode I use to enable filling

Filladapt - better filling through patterns

Seeeeriously the best adaptive filling mode there is. With the customization I made to it, it can even perfectly fill YARDoc comment strings in ruby.

(autoload 'turn-on-filladapt-mode "filladapt" "Turn on the glorious Filladapt mode.")

(defun asf-turn-on-filladapt ()
  (unless (eq major-mode 'org-mode)