Under Emacs mode, typically the default for most shells.
Ctrl + B
Basic moves | |
---|---|
Move back one character |
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
#How I built an audio book reader for my nearly blind grandfather
Last year, when visiting my family back home in Holland, I also stopped by my grand-parents. My grand-father, now 93 years old, had always been a very active man. However, during the presceding couple of months, he'd gone almost completely blind and now spent his days sitting in a chair. Trying to think of something for him to do, I suggested he try out audio books. After finally convincing him -- he said audio books were for sad old people -- that listening to a well performed recording is actually a wonderful experience, I realized the problem of this idea.
####The problem with audio devices and the newly blind. After my first impulse to jump up and go buy him an
require 'pty' | |
require 'expect' | |
PTY.spawn('sftp [email protected]:/uploads') do |input, output| | |
# Say yes to SSH fingerprint | |
input.expect(/fingerprint/, 2) do |r| | |
output.puts "yes" if !r.nil? |
module ConcurrentSpawn | |
def self.run(commands, &block) | |
processes = spawn(commands) | |
collect_output(processes, &block) | |
end | |
def self.spawn(commands) | |
processes = commands.map do |cmd| | |
r, w = IO.pipe |
#!/usr/bin/env bash | |
# | |
# Show an OSX alert | |
# | |
# This is useful when used in conjunction with a long-running script. Use this script to | |
# get a notification when te long-running script finishes. | |
# | |
# Eg: | |
# | |
# $ ./someprocess ; boo |
# Echo number of GIT commits per year. | |
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}' |