View letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)
Virtual hosts
Let's say you want to host domains first.com
and second.com
.
Create folders for their files:
View vpn.md
Don't use VPN services.
No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.
Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.
- A Russian translation of this article can be found here, contributed by Timur Demin.
- A Turkish translation can be found here, contributed by agyild.
- There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
View delayed_job_threads.rb
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
# Only run in server process, not console or rake tasks | |
if !Rails.const_defined?('Console') && !($0 =~ /rake$/) && !Rails.env.test? | |
Rails.application.config.after_initialize do | |
(1..2).each do |thread_id| | |
Thread.new { | |
Thread.current[:thread_name] = "DJ Web Worker Thread #{thread_id}" | |
ActiveRecord::Base.connection_pool.with_connection do |conn| | |
dj = Delayed::Worker.new | |
Rails.logger.warn "Starting #{Thread.current[:thread_name]}" |
View gist:9742059
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
App configuration in environment variables: for and against | |
For (some of these as per the 12 factor principles) | |
1) they are are easy to change between deploys without changing any code | |
2) unlike config files, there is little chance of them being checked | |
into the code repo accidentally | |
3) unlike custom config files, or other config mechanisms such as Java |
View maple_future_0.txt
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
作者 Thor (淡出) 看板 plan | |
標題 Maple未來發展 | |
時間 Fri Jul 24 09:47:41 1998 | |
─────────────────────────────────────── | |
只是隨便取個聳動的標題而已:ppp | |
現在 bbtpd.c opus還沒寫完就消失了, | |
我在想直接接下去寫會不會對他大不敬呀?:P |
View spawn_methods.rb
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
raise "Remove patch after rails 3.2" if Rails.version =~ /\A4/ | |
# copy of lib/active_record/relation/spawn_methods.rb | |
# Because updating to this version 3.2.16 might change the behaviour of some of our queries, | |
# we took a copy of this class and remove the behaviour where | |
module ActiveRecord | |
module SpawnMethods | |
def merge(r) | |
return self unless r | |
return to_a & r if r.is_a?(Array) |
View gist:5704079
Updated for Rails 4.0.0+
Bower
-
Set up the
bower
gem. -
Follow the Bower instructions and list your dependencies in your
bower.json
, e.g.// bower.json
{
View circular.rb
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 'rest-core' | |
module RestCore | |
middleware = Class.new | |
middleware.module_eval do | |
def initialize app | |
@app = app | |
end | |
def call env, &k |
View gist:5307941
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
if [ -f "$rvm_path/scripts/rvm" ]; then | |
source "$rvm_path/scripts/rvm" | |
if [ -f ".rvmrc" ]; then | |
source ".rvmrc" | |
fi | |
if [ -f ".ruby-version" ]; then | |
rvm use `cat .ruby-version` | |
fi |
NewerOlder