Skip to content

Instantly share code, notes, and snippets.

View TheBB's full-sized avatar
🏠
Working from home

Eivind Fonn TheBB

🏠
Working from home
View GitHub Profile

SPC

SPC (Jump to word)

TAB (Previous buffer visible in window)

! (Run shell command)

’ (Pop up shell)

* / (Search in project)

0,1,…,9 (Jump to window)

: (Run M-x)

; (Comment operator)

? (Helm session with keybindings)

(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-configuration-layer-path '("~/.spacemacs.d/")
dotspacemacs-delete-orphan-packages t
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layers
`((auto-completion
:variables
@TheBB
TheBB / loading.org
Last active June 22, 2023 11:53
Loading in Spacemacs

Emacs packages, features, files, layers, extensions, auto-loading, require, provide, use-package… All these terms getting you confused? Let’s clear up a few things.

Files

Emacs files contains code that can be evaluated. When evaluated, the functions, macros and modes defined in that file become available to the current Emacs session. Henceforth, this will be termed as loading a file.

One major problem is to ensure that all the correct files are loaded, and in the

@TheBB
TheBB / test.cpp
Created December 13, 2021 10:45
Pybind11 repro
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
class MyClass {
private:
int value;
public:
@TheBB
TheBB / a.lr
Last active May 5, 2020 09:35
LRSpline bug
# LRSPLINE VOLUME
# p1 p2 p3 Nbasis Nline Nel dim rat
2 2 2 1433 107 1041 3 0
# Basis functions:
0: [0 0 0.02000000000000002 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 0 -2.3 29.77 (1)
1: [0.98 1 1 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 48.5 -2.3 29.77 (1)
2: [0.64 0.6599999999999999 0.6799999999999999 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 32.00999999999999 -2.3 29.77 (1)
3: [0.24 0.26 0.28 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 12.61 -2.3 29.77 (1)
4: [0.5800000000000001 0.6 0.64 ] x [0 0 0.3333333333333333 ] x [0 0 1 ] 29.09999999999999 -2.3 29.77 (1)
5: [0.5800000000000001 0.6 0.64 ] x [0 0 0.3333333333333333 ] x [0 1 1 ] 29.09999999999999 -2.3 30 (1)
[
{
"directory": "/home/eivind/repos/grim/build/vendor",
"command": "/usr/bin/cc -Dmunit_EXPORTS -g -fPIC -o CMakeFiles/munit.dir/munit/munit.c.o -c /home/eivind/repos/grim/vendor/munit/munit.c",
"file": "/home/eivind/repos/grim/vendor/munit/munit.c"
},
{
"directory": "/home/eivind/repos/grim/build/vendor",
"command": "/usr/bin/cc -g -fPIC -o CMakeFiles/zhash.dir/zhash-c/src/zhash.c.o -c /home/eivind/repos/grim/vendor/zhash-c/src/zhash.c",
"file": "/home/eivind/repos/grim/vendor/zhash-c/src/zhash.c"
@TheBB
TheBB / cars.org
Last active June 26, 2019 19:48
Wedding schedule

Car transport table

  • People in brackets are drivers and “main people”.
  • There’s some room for flexibility (especially Sunniva and Thor can switch Passat and Golf more or less as they wish)
  • Passat and Peugeot are the biggest cars, Kun in wedding dress should never be in the Golf or the Hyundai
  • Also, avoid five people in a car if Kun in wedding dress is one of them
  • Especially avoid five people in a car if Kun in wedding dress and Sven with photo gear are both there
  • The words “get” and “put” mean to leave someone or something behind or pick someone or something up, respectively
  • “The Lius” are: Kun’s parents, sister and cousin (four people)

Peugeot (home base Flatåsen)

(defvar-local bb--region-before-change nil)
(defun bb--before-change (beg end)
(setq-local bb--region-before-change
(cons beg (buffer-substring-no-properties beg end))))
(defun bb--after-change (beg end len)
(let* ((pre-beg (car bb--region-before-change))
(pre-str (cdr bb--region-before-change))
(nbytes (string-bytes (substring pre-str (- pre-beg beg) len))))
from functools import wraps
from inspect import getclosurevars
# WITH wraps
def hyphen_decorator(func):
@wraps(func)
def ret():
print('----')
/**
* C program to solve the two-dimensional Poisson equation on
* a unit square using one-dimensional eigenvalue decompositions
* and fast sine transforms.
*
* Einar M. Rønquist
* NTNU, October 2000
* Revised, October 2001
* Revised by Eivind Fonn, February 2015
*/