Skip to content

Instantly share code, notes, and snippets.

@stites
stites / lazynvm.sh
Created February 28, 2018 16:19 — forked from fl0w/lazynvm.sh
# lazyload nvm
# all props goes to http://broken-by.me/lazy-load-nvm/
# grabbed from reddit @ https://www.reddit.com/r/node/comments/4tg5jg/lazy_load_nvm_for_faster_shell_start/
lazynvm() {
unset -f nvm node npm
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
}

I just finished the installation process of my VM (this is try ~5), autoconfiguration of my network device fails, and when I complete the installation and run ifconfig i only see the loopback device. Here's a bit more detail on the host:

# sudo vm list
NAME            DATASTORE  LOADER  CPU  MEMORY  VNC  AUTOSTART  STATE
ubuntu          default    grub    1    512M    -    No         Running (31725)
# sudo vm switch list
@stites
stites / shakeup.sh
Created November 15, 2017 17:21 — forked from mstksg/shakeup.sh
Generate a Shakefile scaffold
#!/bin/bash
SHAKEFILE=${1:-"Shakefile"}
if [ ! -e "$SHAKEFILE" ]; then
tee -a "$SHAKEFILE" << 'EOF' > /dev/null
import Development.Shake
opts = shakeOptions { shakeFiles = ".shake/"
@stites
stites / maybe.py
Created September 19, 2017 21:09
Getting frustrated with python, so here's a hypothetical maybe type.
from collections.abc import Iterator
class Maybe(Iterator):
""" Iterator takes the place of Functor """
__map_index__ = 0
def __init__(self):
super(self).__init__(self)
@stites
stites / gist:d0b70deee3e55b6874f1941a1ff08641
Last active August 2, 2017 14:27
Fsharp-haskell-frame
-- Read Titanic data & group rows by 'Pclass'
titanic :: Frame <- Frame.readCsv(root + "titanic.csv") >>= groupRowsBy<int>("Pclass")
-- Get 'Survived' column and count survival count per clsas
-- runTransform :: Frame -> (Frame -> AnalyzeM Frame) -> IO Frame
byClass <- runTransform titanic $ \df ->
df.GetColumn<bool>("Survived")
|> Series.applyLevel fst (\s ->
-- Get counts for 'True' and 'False' values of 'Survived'
series (Seq.countBy id s.Values))
@stites
stites / tmux-cheatsheet.markdown
Last active March 7, 2017 15:43 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

attach:

tmux attach  #  (or at, or a)
#!/bin/bash
FILE=$1;
if [[ $FILE != *".gz"* ]]
then
echo "Please use a gzipped file"
exit 1
fi
let blacklists = ["https://mail.google.com/*","http://www.codeshare.io/*","https://inbox.google.com/*","https://www.shortcutfoo.com/*","https://binatechnologies.atlassian.net/*","https://onlinedispute.transunion.com/*","http://vim-adventures.com/*","http://student.kaptest.com/*","http://www.keybr.com/*", "http://configurator.input.club/"]
@stites
stites / loggers.js
Last active August 29, 2015 14:10
javascript loggers
// loggers:
var l = console.log.bind(window.console);
var li = function(i){
return function() {
l.apply(window.console, Array.prototype.slice.call(arguments,i,i+1))
};
};
var ln = function(n){
return function() {
l.apply(window.console, Array.prototype.slice.call(arguments,0,n))