Skip to content

Instantly share code, notes, and snippets.

View max-b's full-sized avatar
🚲
👍

maxb max-b

🚲
👍
View GitHub Profile
@max-b
max-b / .tmux.conf
Created April 6, 2018 23:44
Example of tmux config with more than 2 conditional bindings to single key. Useful for vim-tmux-navigation
# Smart pane switching with awareness of vim and fzf and ctrlp
forward_programs="view|n?vim?|ctrlp"
should_forward="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?($forward_programs)(diff)?$'"
bind -n C-h if-shell "$should_forward" "send-keys C-h" "run-shell '[ #{pane_at_left} -eq 1 ] && tmux previous-window || tmux select-pane -L'"
bind -n C-l if-shell "$should_forward" "send-keys C-l" "run-shell '[ #{pane_at_right} -eq 1 ] && tmux next-window || tmux select-pane -R'"
bind -n C-j if-shell "$should_forward" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$should_forward" "send-keys C-k" "select-pane -U"
bind -n C-\ if-shell "$should_forward" "send-keys C-\\" "select-pane -l"
@max-b
max-b / speaker_actor.rs
Last active May 6, 2021 04:46
no need for lifetimes if you have owned sync primitives :)
use eyre::Result;
use sonor::Speaker;
use std::sync::{Arc};
use tokio::sync::Mutex;
use std::thread;
use tokio::sync::mpsc;
use tokio::time::Duration;
pub struct SpeakerActor {
receiver: mpsc::UnboundedReceiver<SpeakerMessage>,

Keybase proof

I hereby claim:

  • I am max-b on github.
  • I am maxbee (https://keybase.io/maxbee) on keybase.
  • I have a public key ASBQf0r9CgFAPZ_UnwJ4CDuv1XkDyQ-pllLj33GAbrKduQo

To claim this, I am signing this object:

@max-b
max-b / Map.js
Created April 16, 2018 23:33
Search code for Recurse interview
const _ = require('lodash');
const Node = require('./Node');
class Map {
constructor(nodes = []) {
this.nodes = nodes;
this.maxNodes = 1000;
}
@max-b
max-b / npm-config-list.stdout
Created January 5, 2017 17:18
`npm config list -l`
; cli configs
long = true
scope = ""
user-agent = "npm/4.0.5 node/v6.9.2 linux x64"
; default values
access = null
also = null
always-auth = false
bin-links = true
@max-b
max-b / npm-debug.log
Created January 5, 2017 17:13
`npm search node-sass` error log
0 info it worked if it ends with ok
1 verbose cli [ '/home/maxb/.nvm/versions/node/v6.9.2/bin/node',
1 verbose cli '/home/maxb/.nvm/versions/node/v6.9.2/bin/npm',
1 verbose cli 'search',
1 verbose cli 'node-sass' ]
2 info using npm@4.0.5
3 info using node@v6.9.2
4 verbose config Skipping project config: /home/maxb/.npmrc. (matches userconfig)
5 silly mapToRegistry name -/all
6 silly mapToRegistry using default registry
@max-b
max-b / 02_network
Created April 29, 2015 05:29
/etc/uci-defaults files
#!/bin/sh
#
# Copyright (C) 2011 OpenWrt.org
#
[ -e /etc/config/network ] && exit 0
touch /etc/config/network
. /lib/functions/uci-defaults.sh