Skip to content

Instantly share code, notes, and snippets.

Benjamin Fleischer bf4

View GitHub Profile
@bf4
bf4 / Gemfile
Last active Nov 11, 2017
Download my destroyallsoftware videos
View Gemfile
# A sample Gemfile
source "https://rubygems.org"
gem 'mechanize'
@bf4
bf4 / README.md
Last active Oct 16, 2017 — forked from claudijd/update.rb
ways to manually update RubyGems without susceptibility to CVE-2015-3900 ref: http://blog.rubygems.org/2015/05/14/CVE-2015-3900.html
View README.md

ways to manually update RubyGems without susceptibility to CVE-2015-3900 (until there is a new ruby release)

because gem update --system uses rubygems to get the newest rubygems-update gem, and the vulnernability is in rubygems...

via ruby:

\curl -sSL https://gist.github.com/bf4/4223e83e8becacfb2a8e/download | \
  tar xzvf - --include 'update.rb' -O | ruby
@bf4
bf4 / ability.rb
Last active Oct 14, 2017
Cancan, rolify, and active admin
View ability.rb
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.has_role? :admin # rolify
can :manage, :all
can :access, :ckeditor
# Performed checks for actions:
can [:read, :create, :destroy], Ckeditor::Picture
View test_schema_jsonapi.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "JSON:API Schema",
"type": "object",
"properties": {
"link": { "$ref": "file://schemata/link.json#" },
"meta": { "$ref": "file://schemata/meta.json#" }
}
}
View 0.README-Linux-Command-Line-Cheat-Sheet.md

A collection of Linux commands and concepts I tend to forget

View gist:e9a7016e4c5dca2d6b8a19d6e10d23c0

Step 0. Install Docker

Step 1. For your chosen project, decide where you want to store your notebooks and files in a workingfolder.

Step 2. Open that folder in the terminal cd workingfolder

Step 3. Run this command

docker run -it --rm -v $PWD:/home/jovyan/work -p 8888:8888 jupyter/all-spark-notebook
View parser-combinator.md

What

A technique for writing parsers.

Why

  • Easy to understand
  • Generally applicable
  • Full power of the programming language at your disposal
  • Declarative
@bf4
bf4 / services.md
Last active Aug 2, 2017
Analytics, Metrics and Error monitoring services (and roll your own via logging, etc)
@bf4
bf4 / setup-pow.bash
Created Nov 10, 2015
pow and powprox install/reinstall
View setup-pow.bash
#!/usr/bin/env bash
install() {
brew cask list lunchy >/dev/null || brew cask install lunchy
pwd=$(pwd)
reinstall_openssl
reinstall_nginx
cd # In case user uses gemsets, ensure we're installing powder outside of a project
@bf4
bf4 / README.md
Last active Jun 30, 2017
clone_all repos
View README.md

Clone all repos

Install as follows

\curl -sSL https://gist.github.com/bf4/c19f041bb0887476dfaa/download | \
  tar xzvf - --include '*setup' -O | bash

optionally first set PROJECT_DIR and PROJECT_CLONE_URL in your ~/.profile

You can’t perform that action at this time.