Skip to content

Instantly share code, notes, and snippets.

View seanrankin's full-sized avatar

Sean Rankin seanrankin

View GitHub Profile
@seanrankin
seanrankin / learn_the_shell.sh
Last active November 30, 2016 18:25
A collection of examples of shell scripts I've found handy
# Securly copy from a remote to local:
scp -r [email protected]:/path/to/folder ~/path/to/folder
# Pipe out commands to the at command
echo "Print this out..." | at 7am
# Sleep then do something
sleep 10 && echo 'Ten seconds have passed.'
# Curl the contents of a file
@seanrankin
seanrankin / remote_script_with_curl.sh
Created August 29, 2014 12:44
Curl and run a remote bash script
#!/bin/bash
# Call this file using curl like this...
# bash < <(curl -L https://raw.githubusercontent.com/srankin/dotfiles/master/remote_script.sh)
# or
# curl https://raw.githubusercontent.com/srankin/dotfiles/master/remote_script.sh | bash
echo "Here are your files:"
ls
#!/bin/bash
# Search twitter for f3counts and email it to me...
# add this to your crontab file:
# curl https://gist.githubusercontent.com/seanrankin/d27c87cbc84a9960037d/raw | bash
# chmod +x t.sh
# First parse out the date
YEAR=$(date '+%Y')
MONTH=$(date '+%m')
DAY=$(date '+%d')
#!/bin/bash
# This script grabs a google form spreadsheet, greps today's record, tally's the count, and
# emails the results. To install, add this to your crontab file:
# curl https://gist.githubusercontent.com/seanrankin/e97bdf73087dffb31b01/raw | bash
# or excute locally, but change the permissions: chmod +x filename.sh
wget --no-check-certificate -q -O - "https://docs.google.com/spreadsheet/ccc?key=1DyeZoB1WwLhzQI7sc9yfiMUS2o80yW3A7ZWpaHLhta8&single=true&gid=0&output=txt" | cut -f1,2,3 | grep $(date +"%-m/%-e/%Y") > results.txt
awk '{sum+=$4} END {print "Todays F3Columbia Totals: " sum}' results.txt >> results.txt
cut -f2,3 results.txt | mail -s "F3Columbia Counts" [email protected]
cat results.txt
@seanrankin
seanrankin / gh_repo_stats.rb
Created November 1, 2014 19:56
A ruby script to query the github search api that returns the most active public repos. Takes start and end dates, GH event name, and # of records.
#!/usr/bin/env ruby
require "optparse"
options = {:after => nil, :before => nil, :event => nil, :count => nil}
parser = OptionParser.new do|opts|
opts.banner = "Usage: gh_repo_stats --after AFTER_DATE --before BEFORE_DATE --event EVENT_NAME --count NUMBER_OF_RECORDS"
opts.on('-a', '--after after', 'After') do |after|
options[:after] = after;
@seanrankin
seanrankin / active_github_repos.rb
Created November 3, 2014 21:18
A simple Ruby script that queries the github api for most active repos, and takes some arguments.
#!/usr/bin/env ruby
# A simple Ruby script that queries the github api for most active repos, and takes some arguments.
# Example => $ ./active_github_repos.rb --after 2004-01-01 --before 2014-01-31 --event tits --count 5
require "optparse"
options = {:after => nil, :before => nil, :event => nil, :count => nil}
parser = OptionParser.new do|opts|
#!/usr/bin/env bash
# A simple collection of cURL commands to explore the github AIP and the utility JQ.
# http://stedolan.github.io
# brew install jq
# How to:
# http://zerokspot.com/weblog/2013/07/18/processing-json-with-jq/
# Everything
@seanrankin
seanrankin / heroku.sh
Last active August 29, 2015 14:15
Heroku Cheat Cheet
# Reset a database
heroku pg:reset olive
heroku run rake db:migrate
heroku run rake db:seed
# Pubilsh a new app to heroku
heroku create appname
git push heroku master
heroku run rake db:migrate
heroku run rake db:seed
@seanrankin
seanrankin / README.md
Created February 11, 2016 14:47 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};