Skip to content

Instantly share code, notes, and snippets.

View subelsky's full-sized avatar
🧘‍♂️

Mike Subelsky subelsky

🧘‍♂️
View GitHub Profile
# Echo number of GIT commits per year.
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}'
@codeinthehole
codeinthehole / boo
Created April 15, 2016 08:20
Notifier script to use with long-running commands
#!/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
@mfrister
mfrister / concurrent_spawn.rb
Last active January 20, 2017 22:39
Concurrently spawn Ruby processes, collect their output and wait for them to exit
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
@kwent
kwent / sftp.rb
Last active April 14, 2021 14:45
Create a ruby pseudo terminal (PTY) and invoke an interactive command (SFTP)
require 'pty'
require 'expect'
PTY.spawn('sftp username@sftp.domain.com:/uploads') do |input, output|
# Say yes to SSH fingerprint
input.expect(/fingerprint/, 2) do |r|
output.puts "yes" if !r.nil?
@wkjagt
wkjagt / audio-book-reader.md
Last active April 12, 2024 14:18
How I built an audio book reader for my nearly blind grandfather

#How I built an audio book reader for my nearly blind grandfather

Tweet this - Follow me

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

@jamieoliver
jamieoliver / push-all-tags.sh
Created March 9, 2014 16:48
Push all Git tags to a remote repository. Useful for keeping a fork up to date with the upstream repo.
git push <remote> --tags
@magnetikonline
magnetikonline / README.md
Last active May 22, 2020 18:55
SSH/Readline cheatsheet.

SSH/Readline cheatsheet

Under Emacs mode, typically the default for most shells.

Ctrl + B
Basic moves
Move back one character
@johanmeiring
johanmeiring / gist:3002458
Created June 27, 2012 08:32
"git lg" alias for pretty git log
# 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 --"
@mislav
mislav / gist:938183
Created April 23, 2011 02:28
Faraday SSL example
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'