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/sh | |
echo_status(){ | |
TEXT=$1 | |
echo "\n $(tput setaf 1)>>>> $(tput setab 7) $TEXT $(tput sgr 0)" | |
} | |
SOKSPROXY_PASS=$(openssl rand -base64 12) | |
echo_status "Updating System and installing dante-server" |
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 | |
# Change mtime of fileless directories to that of latest dir under it, recursively | |
# Empty leaf directories, or dirs with only symlinks get the $default_timestamp | |
# Used on git repo clones after git-restore-mtime for proper Docker layer cache key calculation | |
# git-restore-mtime currently doesn't handle dirs which contain other dirs and no files, see | |
# https://github.com/MestreLion/git-tools/blob/master/git-restore-mtime#L51 | |
# Modified from https://unix.stackexchange.com/a/352334 | |
default_timestamp='1980-01-01 00:00:00' |
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
version: "3" | |
services: | |
web: | |
image: project | |
restart: always | |
command: gunicorn conf.wsgi:application -c /opt/project/tools/docker/provision/gunicorn/production.py | |
expose: | |
- "8000" | |
volumes: | |
- .:/opt/project |
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
def self.tiles_for(lat, lng, search_radius) | |
adj_lat = (lat + 90).floor | |
adj_lng = (lng + 180).floor | |
lat_interval = 110_574 # this is at the poles, its around 111km at the equator so we're using the shorter one - not worth calculating a more accurate value based on lat | |
# this one is from here: http://en.wikipedia.org/wiki/Longitude | |
# specifically: PI / 180 cos(theta) * N(theta), and we're using a fixed value | |
# of N(theta) because its close enough. Basically it is 0 at the poles | |
# and 68 miles at the equator. We'll allow a minimum of 10km though, which is | |
# basically at the poles, because I dont want to use a ton of tiles in |
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
BEFORE: | |
sam@ubuntu discourse % rm -fr tmp/cache | |
sam@ubuntu discourse % rm -fr public/assets | |
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile | |
58.55s user 1.79s system 100% cpu 1:00.02 total | |
AFTER: |
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
--- ext/openssl/ossl.c | |
+++ ext/openssl/ossl.c | |
@@ -1048,6 +1048,7 @@ Init_openssl() | |
*/ | |
/* CRYPTO_malloc_init(); */ | |
/* ENGINE_load_builtin_engines(); */ | |
+ OPENSSL_config(NULL); /* Makes Ruby respect system OpenSSL config */ | |
OpenSSL_add_ssl_algorithms(); | |
OpenSSL_add_all_algorithms(); | |
ERR_load_crypto_strings(); |
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
@Grapes([ | |
@Grab('redis.clients:jedis:1.5.1'), | |
@GrabConfig(systemClassLoader=true) | |
]) | |
import redis.clients.jedis.* | |
performTest("unencoded", null) {n, e-> | |
n.toString() | |
} |
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
class User < ActiveRecord::Base; end; | |
class Post < ActiveRecord::Base; end; | |
class Comment < ActiveRecord::Base; end; | |
class AuthorSerializer < ActiveModel::Serializer | |
attributes :id, :name :created_at, :updated_at | |
end | |
class PostSerializer < ActiveModel::Serializer | |
attributes :id, :body :created_at, :updated_at |
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
RedisSessionStore.logger = Rails.logger | |
session_options = {:expire_after => 1.day, :key_prefix => 'sessions'} | |
MultiSessionStore.stores[:plain] = [RedisSessionStore, session_options.merge(:key => '_session_id')] | |
MultiSessionStore.stores[:secure] = [RedisSessionStore, session_options.merge(:key => '_secure_session_id', :secure => ['production', 'staging'].include?(Rails.env))] | |
MultiSessionStore.default_store = :plain | |
MultiSessionStore.routes = [ | |
['/admin', :secure], | |
] |
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
module CarrierWave | |
module FFMPEG | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def faststart | |
process :faststart => true | |
end | |
def transcode options |