Skip to content

Instantly share code, notes, and snippets.

@justintv
justintv / .bashrc
Created August 17, 2009 00:53
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"
@aidanhs
aidanhs / gist:5ac9088ca0f6bdd4a370
Last active September 25, 2024 11:17
Rust binary tree worked example

PLEASE DON'T USE THIS GUIDE

It's over 9 years old (as of 2024-02-18), there are many better guides! You might like https://rust-unofficial.github.io/too-many-lists/

% Let's build a binary tree!

Let's build a binary tree of strings in Rust. To recap, each node in a binary tree:

  1. must have a value

How to Setup emacs irony-mode in Ubuntu-12.04

I recently found a nice emacs-mode, [irony-mode], which can be used with [company-mode], [flycheck-mode], and [eldoc-mode]. It works nicely with CMake-based projects. The document contains a list of instructions for setting things up. I assume that you're using a fresh-installed Ubuntu-12.04.5 (64-bit). It uses [Lean theorem prover][lean] as an example project.

@rust-play
rust-play / playground.rs
Created June 8, 2018 06:20
Code shared from the Rust Playground
pub struct DemDiscrete {
pub y: Vec<f32>,
pub x: Vec<f32>,
pub fx: Vec<f32>,
}
pub trait Base{
fn get_fx(&self)-> &Vec<f32>;
fn get_x(&self)-> &Vec<f32>;
fn get_y(&self)-> &Vec<f32>;
@Wumpf
Wumpf / cfd.md
Last active September 22, 2024 03:22
Notes on CFD