Skip to content

Instantly share code, notes, and snippets.

@waja
waja / deploy_traefik.sh
Last active April 29, 2024 20:49
Deploy Traefik as Frontend Proxy for Docker
#!/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
@abhiesa
abhiesa / gist:63b3dd8b9aed5f54914d
Last active April 10, 2018 18:05
Setup an Existing Octopress Repository After Git Clone
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
@hopsoft
hopsoft / db.rake
Last active April 3, 2024 13:13
Rails rake tasks for dump & restore of PostgreSQL databases
# 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
@Scarygami
Scarygami / autoawesome-tour.py
Last active December 28, 2015 04:09
Turn your Google+ albums into interactive tours. See [https://googledrive.com/host/0B1pwzJXH7GP8U0M1Ny1mRm5TT0E/] for a live result
#!/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
@Scarygami
Scarygami / autoenhance.py
Last active December 4, 2020 10:14
Simple command-line tool to autoenhance photos via Google+.
#!/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
@mckeed
mckeed / strong_parameters.rb
Created June 5, 2012 22:24
Before filters to make rails/strong_parameters work with CanCan's load_resource or load_and_authorize_resource.
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.
@dex4er
dex4er / base64.sh
Last active April 3, 2024 08:13
Perl oneliners
# 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
@nutrun
nutrun / earl.rb
Created March 3, 2011 02:49
Ruby strings that do web things
# 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"]