This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOCKER_BASE="${DOCKER_BASE:-/srv/docker}" | |
TRAEFIK_DIR="${TRAEFIK_DIR:-traefik}" | |
mkdir -p ${DOCKER_BASE}/${TRAEFIK_DIR}/container.conf | |
touch ${DOCKER_BASE}/${TRAEFIK_DIR}/container.conf/.env | |
ln -s container.conf/.env ${DOCKER_BASE}/${TRAEFIK_DIR}/ | |
cat > ${DOCKER_BASE}/${TRAEFIK_DIR}/container.conf/docker-compose.yml <<EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basically, you need to create and link the deploy directory to master branch. | |
First, we clone the repo and switch to the correct branch: | |
1) git clone https://github.com/username/username.github.io.git | |
2) git checkout source | |
Then we need to setup the deploy directory. | |
1) mkdir _deploy | |
2) cd _deploy | |
3) git init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Copyright 2013 Gerwin Sturm, FoldedSoft e.U. | |
# www.foldedsoft.at / google.com/+GerwinSturm | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Copyright 2013 Gerwin Sturm, FoldedSoft e.U. | |
# www.foldedsoft.at / google.com/+GerwinSturm | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'strong_parameters' | |
class ActiveRecord::Base | |
include ActiveModel::ForbiddenAttributesProtection | |
end | |
class ActionController::Base | |
# Use this with CanCan's load_resource to permit a set of params before | |
# it tries to build or update a resource with them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Encoding file | |
perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' < file | |
# Decoding file | |
perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.b64 | |
# HMAC-SHA1 | |
perl -MDigest::HMAC_SHA1 -le '$_=Digest::HMAC_SHA1->new($ARGV[0])->add($ARGV[1])->b64digest; $_.="=" x length % 4; print' TestKey TestString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Earl: Strings that do web things | |
# | |
# | |
# Examples: | |
# | |
# text = "Blah blah http://tinyurl.com/4bnjzbu blah http://tinyurl.com/4tefu9f" | |
# | |
# text.urls # => ["http://tinyurl.com/4bnjzbu", "http://tinyurl.com/4tefu9f"] | |
# | |
# text.locations # => ["http://nutrun.com/weblog/2010/11/17/supercharged-ruby-console-output.html", "http://nutrun.com"] |