Skip to content

Instantly share code, notes, and snippets.

View unhammer's full-sized avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
(defvar-keymap embark-org-column-map
:doc "Keymap for Embark org-column actions."
:parent embark-org-table-map
"M-r" #'my-cua-enable-and-replace-in-rectangle-embark)
(defun my-embark-org-column-at-point ()
"Target the org-column at point."
(when-let ((org-column
(and (org-at-table-p)
(not (looking-at-p "|")) ; since then we don't know which column you mean
@unhammer
unhammer / speakersPerLanguage.sparql
Last active August 14, 2023 09:09
Number of speakers per language in the world based on Wikidata (including dupes due to measuring speakers at different times / from different sources). Note that 6915 languages have iso 639-3 codes in wikidata, but only 1614 languages have data for number of speakers (presumably the languages with no data are at the lower end of the list)
SELECT DISTINCT ?item ?numberOfSpeakers ?speakersTime ?iso639_1 ?iso639_3 ?itemLabel ?itemLabel_en
WHERE {
?item wdt:P31 wd:Q1288568; # Any instance of a modern (current use) language
wdt:P220 ?iso639_3; # that has an ISO 639-3 code
# Require number of speakers, but as a statement so we can get the "timestamp" of the property:
?item p:P1098 ?numberOfSpeakersStatement .
?numberOfSpeakersStatement ps:P1098 ?numberOfSpeakers.
optional {
?numberOfSpeakersStatement pq:P585 ?speakersTime.
@unhammer
unhammer / git-is-related
Last active April 5, 2022 08:08 — forked from simonwhitaker/git-is-ancestor
A script to determine whether one git commit is the ancestor of another
@unhammer
unhammer / Adder.hs
Created November 24, 2021 20:04 — forked from mtolly/Adder.hs
Small example of compiling a Haskell Mac .dylib to be used from C
{-# LANGUAGE ForeignFunctionInterface #-}
module Adder where
import Foreign.C
adder :: CInt -> CInt -> IO CInt
adder x y = return $ x + y
foreign export ccall adder :: CInt -> CInt -> IO CInt
@unhammer
unhammer / Words.hs
Created December 14, 2020 08:55
Data.Algorithm.Diff.Words extension to Diff package
-----------------------------------------------------------------------------
-- |
-- Module : Data.Algorithm.Diff.Words
-- Copyright : (c) Kevin Brubeck Unhammer 2020
-- License : BSD 3 Clause
-- Maintainer : s.clover@gmail.com
-- Stability : experimental
-- Portability : portable
--
-- Convenience functions for "word-diffing" / grouping diffs by separators.
@unhammer
unhammer / Pascal.hs
Last active December 8, 2020 13:52 — forked from queertypes/Pascal.hs
Pascal's triangle in Haskell
import Control.Applicative ((<$>))
center :: String -> Int -> String
center s n = spaces ++ s ++ spaces
where spaces = replicate ((n - length s) `div` 2) ' '
-- http://www.haskell.org/haskellwiki/Blow_your_mind, Ctrl-F "pascal"
pascal :: [[Int]]
pascal = iterate (\row -> zipWith (+) ([0] ++ row) (row ++ [0])) [1]
@unhammer
unhammer / .tmux.conf
Last active November 2, 2020 09:14
tmux double-click menu with "open in emacs" item
bind-key -T root DoubleClick1Pane if-shell -F -t = "#{||:#{mouse_any_flag},#{pane_in_mode}}" "select-pane -t=; send-keys -M" "display-menu -t= -xM -yM -T \"#[align=centre]#{pane_index} (#{pane_id})\" 'Open in Emacs' 'e' {run 'cd \"#{pane_current_path}\" && ~/bin/switch-to-emacsclient \"#{q:mouse_word}\"'} '' '#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}' 'C-r' {copy-mode -t=; send -Xt= search-backward \"#{q:mouse_word}\"} '#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},}' 'C-y' {send-keys -l -- \"#{q:mouse_word}\"} '#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},}' 'c' {set-buffer -- \"#{q:mouse_word}\"} '#{?mouse_line,Copy Line,}' 'l' {set-buffer -- \"#{q:mouse_line}\"} '' 'Horizontal Split' 'h' {split-window -h} 'Vertical Split' 'v' {split-window -v} '' 'Swap Up' 'u' {swap-pane -U} 'Swap Down' 'd' {swap-pane -D} '#{?pane_marked_set,,-}Swap Marked' 's' {swap-pane} '' '#{?pane_marked,Unmark,Mark}' 'm' {select-pane -m} '#{?wind
@unhammer
unhammer / test.html
Created June 25, 2020 18:14
alsadjfa
<html>
<head>
<style>
h1 {
font-family: Verdana;
}
</style>
</head>
<body>
<h1>RAWR</h1>

blah

stuff!

code:

{
  "foo": "bar"
}