This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"-----------------------" | |
" .vimrc | |
" author: @splinter1984 | |
"-----------------------" | |
set number | |
syntax enable | |
set smarttab | |
set visualbell | |
set wildmenu | |
set ruler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// schedule_read is called o start reading | |
void connection::connect() | |
{ | |
boost::asio::ip::tcp::resolver resolver(_io); | |
boost::asio::ip::tcp::resolver::query query(_hostname, std::to_string(_port)); | |
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query); | |
boost::system::error_code ec; | |
boost::asio::connect(_socket, iterator, ec); | |
if (ec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Queue with minimum | |
Implement a queue that can also tell what is the current minimum. **The implementation must have O(1) complexity for all calls.** | |
*/ | |
use std::collections::VecDeque; | |
pub struct MinQueue<T> { | |
val_stack: VecDeque<T>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn comb<T>(slice: &[T], k: usize) -> Vec<Vec<T>> | |
where | |
T: Copy, | |
{ | |
//If k == 0, return a empty new vector | |
if k == 0 { | |
return vec![vec![]]; | |
} | |
// If arr.is_empty(), return a empty new vector | |
if arr.is_empty() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Dynamic URDF Publisher | |
# | |
# This script monitors a URDF file and when changed will publish to /robot_description | |
# | |
# Requirements: | |
# Besides the standard Ros2 modules, Install watchdog module for listening | |
# to filesystem events: | |
# `pip3 install watchdog` | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module posh-git | |
function Write-BranchName () { | |
try { | |
$branch = git rev-parse --abbrev-ref HEAD | |
if ($branch -eq "HEAD") { | |
# we're probably in detached HEAD state, so print the SHA | |
$branch = git rev-parse --short HEAD | |
Write-Host " ($branch)" -NoNewline -ForegroundColor "red" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]$ " |