Skip to content

Instantly share code, notes, and snippets.

View jrgifford's full-sized avatar
:shipit:
This is like AIM all over again, isn't it?

James Gifford jrgifford

:shipit:
This is like AIM all over again, isn't it?
View GitHub Profile
company_names = ["Tekfly", "Yabox", "Vinder", "Skiptube", "Fivespan"]
company_names.each_with_index do |company_name, index|
puts "#{company_name} has index #{index}"
end
Tekfly has index 0
Yabox has index 1
Vinder has index 2
Skiptube has index 3
Fivespan has index 4
company_names = ["Tekfly", "Yabox", "Vinder", "Skiptube", "Fivespan"]
[8] pry(main)> is_enumerable?("I'm a string")
=> false
[9] pry(main)> is_enumerable?(["array", "of", "things"])
=> true
def is_enumerable?(object)
object.is_a? Enumerable
end
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease -O /tmp/InRelease.xyz
if test /tmp/InRelease.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
@jrgifford
jrgifford / openssl-fix.yml
Last active May 3, 2016 17:22 — forked from carsongee/openssl-fix.yml
CVE-2016-2108 SSL Ansible check and correct play for Ubuntu
---
# Patches openssl problem and restarts needed services
- name: Apply common configration to all nodes
hosts: all
sudo: yes
# Uncomment to apply update one server at a time
# serial: 1
tasks:
- name: "Install packages and update cache"
@jrgifford
jrgifford / -
Created March 19, 2016 00:25 — forked from zenhob/-
#!/bin/sh
#
# Patches and installs Ruby to expose OpenSSL context options, using rbenv.
#
# Based on http://philippe.bourgau.net/how-to-install-a-patched-ruby-interpreter-wit/
#
VERSION=2.1.6
PATCH_URL="https://bugs.ruby-lang.org/attachments/download/4210/0001-Expose-the-SSLContext-options-attribute-in-Net-HTTP.patch"
PATCH_NAME=ssloptions
@jrgifford
jrgifford / friday_deploy_cap2.rb
Created January 22, 2016 18:08 — forked from exAspArk/friday_deploy_cap2.rb
Friday deploy script for Capistrano
# Capistrano 2
before "deploy", "friday:good_luck"
namespace :friday do
friday_jumper = %{
┓┏┓┏┓┃
┛┗┛┗┛┃⟍ ○⟋
┓┏┓┏┓┃ ∕ Friday
┛┗┛┗┛┃ノ)
@jrgifford
jrgifford / gist:6e3cfb2f3edb645fc804
Created December 28, 2015 18:47 — forked from tinogomes/gist:1182499
credit card validation on ruby
# References
# http://en.wikipedia.org/wiki/Bank_card_number
# http://en.wikipedia.org/wiki/Luhn_algorithm
def valid_credit_card?(number)
number = number.to_s.gsub(/\D/, "")
return false unless valid_association?(number)
number.reverse!