Skip to content

Instantly share code, notes, and snippets.

View al3xandru's full-sized avatar

Alex Popescu al3xandru

View GitHub Profile

Spacemacs layout and eyebrowse layers

The “layout” layer is quite confusing. It is basically meant to offer an option to isolate a set of buffers and configure a set of windows.

This is the workflow I have that seems to work for me (nb: I'm using most of the time projects in their own frame):

Creating:

@al3xandru
al3xandru / gist:1128606
Created August 5, 2011 21:51
nvALT Bookmarklet
javascript:(function({
var INSTAPAPER=true,w=window,d=document,pageSelectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageTitle=d.title,pageUri=w.location.href,tmplt="";
tmplt="From ["+pageTitle+"]("+pageUri+"):\n\n";
if(pageSelectedTxt!="") {
pageSelectedTxt=">%20"+pageSelectedTxt;
pageSelectedTxt=pageSelectedTxt.replace(/(\r\n|\n+|\r)/gm,"\n");
pageSelectedTxt=pageSelectedTxt.replace(/\n/g,"\n>%20\n>%20");
w.location.href="nvalt://make/?txt="+encodeURIComponent(tmplt+pageSelectedTxt)+"&title="+encodeURIComponent(pageTitle)
}
else {
@al3xandru
al3xandru / 000_WDR_template_COPY_ME.md
Created June 29, 2022 18:41 — forked from tastapod/000_WDR_template_COPY_ME.md
Writing Decision Record (WDR) template we are using for coauthoring the Software Faster book

000 - Title that says what decision we made

  • Deciders: Daniel and Helen
  • Date: 2022-mm-dd
  • Obsoletes: WDR-nnn

Description

Prose description of the decision and its context. What did we decide? What caused us to make the decision? What else was going on at the time?

@al3xandru
al3xandru / gist:1169583
Created August 24, 2011 23:31
OmniFocus Generalized Bookmarklet
javascript:(function(){
var enc=encodeURIComponent,
w=window,
frames=w.frames,
d=document,
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),
pu=w.location.href,
isGMail=w.location.host.match(/mail\.google\.com/),
tt=pt=d.title,
subjSpans=d.getElementsByClassName("hP"),i,url;
@al3xandru
al3xandru / moveWndNextSpace.lua
Last active February 17, 2019 01:57
Hammerspoon function for moving window to next desktop
-- Move window to adjacent Desktop
-- direction param can be 'left' or 'right'
function moveWndNextSpace(direction)
local win = hs.window.focusedWindow() or hs.window.frontmostWindow()
if not win then
return
end
if not win:isStandard() then
return
end
@al3xandru
al3xandru / latency.txt
Created October 15, 2018 01:20 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@al3xandru
al3xandru / tmux-cheatsheet.markdown
Created March 25, 2018 07:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@al3xandru
al3xandru / .tmux.conf
Created October 1, 2017 01:26
.tmux.conf reattach-to-user-namespace
# macOS clipboard
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
if-shell 'test "$(uname -s)" = Darwin' 'set-option -g default-command "exec reattach-to-user-namespace -l bash"'
@al3xandru
al3xandru / error.lua
Created August 23, 2017 05:32
Using screen function in hs.layout results in "Unable to find display: function: 0x60800084a3b0"
layout = {
{"Mail", nil, function() attemptSecondaryScreen() end, hs.geometry.unitrect(0, 0, 1, 0.7), nil, nil},
{"Slack", nil, attemptSecondaryScreen, hs.geometry.unitrect(0, 0.3, 1, 0.7), nil, nil}
}
function attemptSecondaryScreen()
local screens = hs.screen.allScreens()
if #screens > 1 then
for _, scr in ipairs(screens) do
if scr ~= hs.screen.primaryScreen() then
@al3xandru
al3xandru / spacemacs.md
Created January 31, 2016 18:02
How to do stuff in Spacemacs/Emacs
  1. Frame, Window, Buffer manipulation

    • open/close/navigate buffers
    • open/close/navigate windows
    • open/close/navigate frames
    • open/close/navigate tabs(?)
  2. Basic moves

    • next word, back word, end of word
    • next/prev sentence
  • next/prev paragraph