Skip to content

Instantly share code, notes, and snippets.

View dsanson's full-sized avatar

David Sanson dsanson

View GitHub Profile
{
"1": {
"light": "https://images.unsplash.com/photo-1600266573467-16ab6cb278ec?w=2000&q=100",
"dark": "https://images.unsplash.com/photo-1506296933720-1a0ce9bed41d?w=2000&q=100"
},
"2": {
"light": "https://images.unsplash.com/photo-1498234611539-1cfb1e28fa6f?w=2000&q=100",
"dark": "https://images.unsplash.com/photo-1584351583369-6baf055b51a7?w=2000&q=100"
},
"3": {
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -103,7 +103,7 @@ static relaxed_atomic_t<pid_t> initial_fg_process_group{-1};
/// This struct maintains the current state of the terminal size. It is updated on demand after
/// receiving a SIGWINCH. Use common_get_width()/common_get_height() to read it lazily.
static constexpr struct winsize k_invalid_termsize = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX};
-static owning_lock<struct winsize> s_termsize{k_invalid_termsize};
+static relaxed_atomic_t<struct winsize> s_termsize(k_invalid_termsize);
static relaxed_atomic_bool_t s_termsize_valid{false};
@dsanson
dsanson / fish-kitty-terminal-dimensions.diff
Created May 25, 2020 21:16
Patch to fix bug in fish that causes incorrect terminal size reporting
https://github.com/fish-shell/fish-shell/issues/6994#issuecomment-633303722
diff --git a/src/common.cpp b/src/common.cpp
index f76445fc0..57d66695a 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -103,7 +103,7 @@ static relaxed_atomic_t<pid_t> initial_fg_process_group{-1};
/// This struct maintains the current state of the terminal size. It is updated on demand after
/// receiving a SIGWINCH. Use common_get_width()/common_get_height() to read it lazily.
static constexpr struct winsize k_invalid_termsize = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX};
-static owning_lock<struct winsize> s_termsize{k_invalid_termsize};
@dsanson
dsanson / gist:e541f0b72c9066768fd5
Last active February 15, 2017 22:34
My cvimrc
set autoupdategist
set noautofocus
set nocncpcompletion
set smoothscroll
set hud
set noregex
set noinsertmappings
set typelinkhints
set defaultnewtabpage
#!/bin/bash
#
# Get A Phil Papers Item (gappi); version 0.3
# by Kevin C. Klement (klement@philos.umass.edu)
# Feel free to email Kevin with suggestions or questions
# License: GPLv3
#
# get the name of the script
SCRIPTNAME="$(basename "$0")"
@dsanson
dsanson / gist:9289a3f15c25b7ba82ed
Created December 23, 2014 18:37
How Can I Craft This Again Chords
C G Am F
You get online and the world forms 'round you
C G Dm F
It's been a while, haven't played since point 2!
C G Am F
You break a smile, 'cause you've almost forgot to mine
C G Dm F C G
It's just been such a long time! And every time you're denied
Am F C G
@dsanson
dsanson / gist:1919205
Created February 26, 2012 22:00
Vim Folding for RIS files
" Some folding functions for using Vim with RIS files...
" Lines starting with 'TY -' trigger folds
set foldexpr=RIS_Fold()
set foldmethod=expr
fun! RIS_Fold()
let thisline = getline(v:lnum)
if thisline =~ '^TY -.*'
return '>1'
@dsanson
dsanson / extract_bib.rb
Created November 21, 2011 16:25
Generate a bibtex file containing works cited in a given pandoc extended markdown file
#!/usr/bin/env ruby
bibfile = "~/.pandoc/default.bib"
matches = ARGF.read.scan(/@(.*?)[\.,:;\] ]/)
reg = "\\(" + matches.join("\\)\\|\\(") + "\\)"
system 'bibtool -X \'' + reg + '\' ' + bibfile
@dsanson
dsanson / odt2pandoc.py
Created September 20, 2011 21:44
a slight tweak of odt2txt.py
#!/usr/bin/env python
"""
ODT2PANDOC
==========
ODT2PANDOC is a slight variant of ODT2TXT. Right now, the only differences are that it generates ATX style headers and uses *asterisks* for italics, neither of which is in any way specific to pandoc's extended markdown.
ODT2TXT
=======
@dsanson
dsanson / vimshortcuts.html
Created September 8, 2011 20:34
an HTML VIM movement cheatsheet for use with NerdTool
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
This is an HTML version of a great [VIM movements cheatsheet][] designed by Ted Naleid.
I made this because I wanted more control over the way the text was displayed, and I'd rather tweak CSS than mess with Omnigraffle. If you just want Ted's graphic overlaid on your desktop, you should download the [transparent version] of the VIM movements cheatsheet.
I use it with [NerdTool][]. Sadly, NerdTool can't overlay transparent HTML. So I supply a background-image URL. You'll want to change that to something on your local filesystem. Here is a [screenshot][] of the results. The background image is taken from the always great [Bibliodyssey][], resized to the size of my screen.