Skip to content

Instantly share code, notes, and snippets.

View jsilve24's full-sized avatar

Justin Silverman jsilve24

View GitHub Profile
@progfolio
progfolio / general-spacemacs.org
Last active March 20, 2024 17:04
Spacemacs-like menus using general.el

Spacemacs-like menus using general.el

Global keybindings

First, we define a global prefix key:

(general-create-definer global-definer
  :keymaps 'override
  :states  '(insert emacs normal hybrid motion visual operator)
  :prefix  "SPC"
  :non-normal-prefix "S-SPC")
@jsilve24
jsilve24 / colQuantiles.cpp
Last active August 20, 2018 20:11
Fast calculation of quantiles for each column of a matrix using Rcpp
#include <Rcpp.h>
using namespace Rcpp;
// q is a vector of quantiles to calculate for each column of x
// [[Rcpp::export]]
NumericMatrix colQuantiles(NumericMatrix x, NumericVector q) {
int c = x.ncol();
int r = x.nrow();
int n = q.length();
NumericMatrix out(n, c);
@mijoharas
mijoharas / README.md
Last active December 21, 2021 16:28
navigate emacs or i3 depending on whether emacs is focussed.

i3-navigate-emacs

Usage:

Create bash file above and put it in your path. add these lines to your i3/config:

# change focus
bindsym $alt+$left exec i3-navigate-emacs left
bindsym $alt+$down exec i3-navigate-emacs down
bindsym $alt+$up exec i3-navigate-emacs up
@simonmichael
simonmichael / init.el
Last active March 16, 2023 09:30
emacs: simple window splitting policy
;; Try to ensure sensible window splitting, independent of frame and font size.
;; Things I don't want:
;; - excessive horizontal splitting (generally I prefer no more than 2 windows across)
;; - horizontal splitting when frame is tall and narrow (causing eg useless narrow man page formatting)
;; So, aim for a simple policy: popup windows shall be half width in a wide frame,
;; half height in a tall frame.
;;
;; Emacs' window splitting behaviour is complex and must be read carefully.
;; In particular, note: it checks split-window-height first, and if that permits it to
;; split vertically, it does that and split-window-horizontally is ignored.
@gocarlos
gocarlos / Eigen Cheat sheet
Last active February 11, 2024 14:07
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
@agzam
agzam / all ex commands.org
Last active September 14, 2022 14:36
All ex commands
e[dit]evil-edit
w[rite]evil-write
wa[ll]evil-write-all
sav[eas]evil-save
r[ead]evil-read
b[uffer]evil-buffer
bn[ext]evil-next-buffer
bp[revious]evil-prev-buffer
bN[ext]bprevious
sb[uffer]evil-split-buffer
@pervognsen
pervognsen / wm.el
Last active October 22, 2023 02:10
Dynamic tiling window manager for Emacs (inspired by dwm/awesome/xmonad for Linux)
; This code is hereby released by its author (Per Vognsen) into the public domain.
; It's mostly a proof of concept though it was surprisingly usable for how simple it was to code.
; If you want to use it as a starting point for a more polished package, go right ahead.
(require 'cl)
(defstruct wm-window buffer (point 0) (start 0) (hscroll 0) dedicated)
(defvar wm-windows)
(defvar wm-windows-alist)
<?php
$port = fopen('/dev/ttyUSB0', 'w');
fwrite($port, 'A');
fwrite($port, 'a');
fclose($port);