Skip to content

Instantly share code, notes, and snippets.

@bf4
bf4 / 2014-09-30-sample.rb
Created March 9, 2017 04:12
my little mailer
message.to = 'Person Name <person@example.com>'
message.subject = 'Sample Subject'
# body is probably good enough, but you can set text_part/html_part below if you like
message.body = <<HERE.strip
Hey-
This is a sample
Thanks
HERE
@bf4
bf4 / dontforget.bash
Created February 20, 2017 02:19 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
#!/bin/bash
# dontforget
#
# A stupid script for short term reminders in bash
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
# be any other numeric digits.
#
@bf4
bf4 / _dev_badge.html.slim
Created February 1, 2017 16:48 — forked from stevenharman/_dev_badge.html.slim
A simple badge that shows your Rails environment.
/ In app/views/shared/
#dev-badge
span= Rails.env
span It ain't production!
require 'warden/github'
class SidekiqGithubChecker
def self.registered(app)
app.helpers do
def warden; env['warden'] end
def github_organization_authenticate!(name)
unless warden.user.organization_member?(name)
halt [401, {}, ["You don't have access to organization #{name}"]]
end
@bf4
bf4 / file.md
Created January 16, 2017 17:07 — forked from jjb/file.md
Trying to figure out performance impact of RUBY_GC_HEAP_GROWTH_FACTOR
@bf4
bf4 / README.md
Created January 6, 2017 04:28 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@bf4
bf4 / all_aws_lambda_modules.txt
Created December 15, 2016 16:09 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules and post the list to Pastebin
# module list (generated by listmodules.py)
#
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
#
BaseHTTPServer
Bastion
CDROM
@bf4
bf4 / bash_trap_template.sh
Created November 1, 2016 15:01 — forked from sechiro/bash_trap_template.sh
Bash signal trap template. Bashでよく使うシグナルトラップのテンプレート。
#!/bin/bash
set -u # Check unset variables only
#set -ue # Check unset variables. Exit on error
LANG=C
# Trap signals
trap_HUP() {
echo "Trap HUP signal."
exit 1
}
@bf4
bf4 / everytimezone.coffee
Created October 31, 2016 00:42 — forked from madrobby/everytimezone.coffee
First conversion of http://everytimezone.com/ JavaScript code to CoffeeScript
# Two things are important to note:
#
# 1) The code is fugly, because it was a JavaScript/iPad experiment.
# I know that it is ugly, so pretty please don't comment on that part.
# 2) I tried to use as many CoffeeScript features as possible,
# including but not limited to list comprehensions,
# heredocs, destructuring assignment and also the "do" operator
#
# I welcome comments about stuff that is not CoffeeScripty enough, or what I should
# write differently.
@bf4
bf4 / post.md
Created September 7, 2016 22:16 — forked from fxn/post.md
GeoPlanet data with ancestor chain cache imported in 10 minutes

GeoPlanet data with ancestor chain cache imported in 10 minutes

Yahoo! provides its GeoPlanet data as three separate TSV files, available for download here.

That's a database with some 17 million records:

  • 5.7 million records: locations (aka places).
  • 2.2 million records: alternative names for each place (aka aliases).
  • 9.6 million records: matrix of neighbourhoods per place (aka adjacencies).