This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _POSIX_C_SOURCE 200809L // For strdup. | |
#include <stdio.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <math.h> // Remember to link with -lm. | |
#define ARRAY_LEN(array) (sizeof(array) / sizeof((array)[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; A simple minor mode for programming competitions. -*- lexical-binding: t -*- | |
;; competition.el is free software: you can redistribute it and/or modify it | |
;; under the terms of the GNU General Public License as published by the Free | |
;; Software Foundation, either version 3 of the License, or (at your option) any | |
;; later version. | |
;; Improvement ideas: | |
;; | |
;; * Add a keybinding that will prompt for a test name, e.g. `A-small', then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Asynchronous detailed git modeline. | |
;; git-ml is free software: you can redistribute it and/or modify it under the | |
;; terms of the GNU General Public License as published by the Free Software | |
;; Foundation, either version 3 of the License, or (at your option) any later | |
;; version. | |
;; This is a rough sketch. Things to do before publishing it as a package: | |
;; | |
;; * Consider doing the checks per git directory instead of per buffer, then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Shortcuts for quick-and-dirty Git usage. Useful when you need backups and sync but not a pretty history. | |
import argparse | |
import os | |
import subprocess | |
import sys | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
library(ggplot2) | |
library(reshape2) | |
library(pander) | |
data <- read.csv("results/results.csv", check.names=FALSE) | |
# Reorder columns for readability. | |
col_order <- c("Least-squares slope", "Theil-Sen slope", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, random | |
from PyQt4 import QtGui, QtCore | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.figure import Figure | |
class MplCanvas(FigureCanvas): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(package-initialize) ; Load package.el and all packages now. This normally happens after loading the init file. | |
(setq package-enable-at-startup nil) ; Don't load the packages the second time after the init file. | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "http://melpa.milkbox.net/packages/"))) | |
;; To update installed packages, use M-x package-list-packages RET U x. | |
;; Or delete the elpa/ directory and launch Emacs for it to be recreated. | |
(defun package-ensure-installed (package) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rename-this-buffer-and-file () | |
"Renames the current buffer and the file it is visiting (after saving it)." | |
(interactive) | |
(save-buffer) | |
(let ((filename (buffer-file-name))) | |
(unless filename | |
(error "Not visiting a file")) | |
(unless (file-exists-p filename) | |
(error "File \"%s\" doesn't exist" filename)) | |
(let ((new-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Bindings. | |
(define-key sp-keymap (kbd "C-M-f") 'sp-forward-sexp) | |
(define-key sp-keymap (kbd "C-M-b") 'sp-backward-sexp) | |
(define-key sp-keymap (kbd "C-M-d") 'sp-down-sexp) | |
(define-key sp-keymap (kbd "C-M-a") 'sp-backward-down-sexp) | |
(define-key sp-keymap (kbd "C-S-a") 'sp-beginning-of-sexp) | |
(define-key sp-keymap (kbd "C-S-d") 'sp-end-of-sexp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Remap basic motions to [htns] (for a Dvorak keyboard). | |
;;; Also remap some related keys. | |
(require 'conf/evil) | |
;; Left, down, up, right: [htns] (previously: [hjkl]). | |
(define-key evil-motion-state-map "h" 'evil-backward-char) | |
(define-key evil-motion-state-map "t" 'evil-next-line) | |
(define-key evil-motion-state-map "n" 'evil-previous-line) | |
(define-key evil-motion-state-map "s" 'evil-forward-char) (define-key evil-normal-state-map "s" nil) |
NewerOlder