Skip to content

Instantly share code, notes, and snippets.

Alex Popescu al3xandru

Block or report user

Report or block al3xandru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@al3xandru
al3xandru / moveWndNextSpace.lua
Last active Feb 17, 2019
Hammerspoon function for moving window to next desktop
View moveWndNextSpace.lua
-- 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 Oct 15, 2018 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
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
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@al3xandru
al3xandru / .tmux.conf
Created Oct 1, 2017
.tmux.conf reattach-to-user-namespace
View .tmux.conf
# 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 Aug 23, 2017
Using screen function in hs.layout results in "Unable to find display: function: 0x60800084a3b0"
View error.lua
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
View java-dse-graph.xml
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>java-dse-graph</artifactId>
<version>1.0.0-beta1</version>
</dependency>
@al3xandru
al3xandru / nmap.vim
Created Nov 4, 2016
Paste clipboard text as Markdown blockquote
View nmap.vim
nmap <localleader>bq pmaV`gw`a:s/^/> /g<CR>:nohlsearch<CR>o
View kc60_end_user_notes.md

KC60 Keyboard end-user tips, tricks, programming notes, etc.

Leimi's note: removed lots of stuff from the original gist of scottjl, (thanks to him by the way!), as in the end some wasn't useful for me. If you are intestered, go check the gist revisions.

The KC60 is kinda like a premade GH60 that was first sold on Massdrop during summer 2015.
It runs on TMK firmware, or something based on it at least (not sure this is the real source for the keyboard but it seems it is), which means it's heavily programmable.
There is a GUI tool (the source of this tool seems to be here) and a command-line tool to ease up the process of programming the board.
**Go check this great article on Key

@al3xandru
al3xandru / .vimrc
Created Jun 19, 2016
Trying to create new mappings for vim-orgmode promote header/subtree
View .vimrc
augroup org
autocmd!
autocmd FileType org nmap <M-Left> <ah
autocmd FileType org nmap <M-S-Left> <ar
autocmd FileType org nmap <D-Left> <ah
autocmd FileType org nmap <D-S-Left> <ar
augroup END
View C-h company-active-map
Value: (keymap
(12 . company-complete-selection)
(11 . company-select-previous)
(10 . company-select-next)
(4 . company-show-doc-buffer)
(67108911 . company-search-candidates)
(backtab . spacemacs//company-complete-common-or-cycle-backward)
(S-tab . spacemacs//company-complete-common-or-cycle-backward)
(19 . company-search-candidates)
(23 . company-show-location)
You can’t perform that action at this time.