This file contains hidden or 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
| -- CREATE read-only user when the user was created via the Google Cloud API (ie terraform) | |
| -- GOOGLE CLOUD by default give fairly broad permissions | |
| -- Prior reading https://stackoverflow.com/questions/13497352/error-permission-denied-for-relation-tablename-on-postgres-while-trying-a-selec | |
| -- https://www.digitalocean.com/docs/databases/postgresql/how-to/modify-user-privileges/ | |
| REVOKE ALL ON DATABASE db FROM "dev-readonly"; | |
| -- This next line is important | |
| REVOKE cloudsqlsuperuser FROM "dev-readonly"; | |
| GRANT USAGE ON SCHEMA public TO "dev-readonly"; | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "dev-readonly"; |
This file contains hidden or 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
| create table z(a date, b Int64) Engine=MergeTree Partition by toYYYYMM(a) order by a; | |
| insert into z select today(), number from numbers(1000000000); | |
| insert into z select yesterday(), number from numbers(1000); | |
| create table mv_z_store(a date, max_b AggregateFunction(MAX,Int64)) ENGINE = AggregatingMergeTree Partition by toYYYYMM(a) order by a; | |
| create table temp(a date, b Int64) Engine=Null; | |
| create MATERIALIZED VIEW mv_z to mv_z_store AS SELECT a, maxState(b) AS max_b FROM temp GROUP BY a; | |
| insert into temp select * from z; | |
| drop table mv_z; | |
| drop table temp; |
This file contains hidden or 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
| ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
| # Don't add passphrase | |
| openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
| cat jwtRS256.key | |
| cat jwtRS256.key.pub |
This file contains hidden or 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 | |
| ### BEGIN INIT INFO | |
| # Provides: unicorn | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Start unicorn at boot time | |
| # Description: Run input app server | |
| ### END INIT INFO |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>Stripe Getting Started Form</title> | |
| <!-- The required Stripe lib --> | |
| <script type="text/javascript" src="https://js.stripe.com/v2/"></script> | |
| <!-- jQuery is used only for this example; it isn't required to use Stripe --> |
This file contains hidden or 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 | |
| # | |
| # chkconfig: - 85 15 | |
| # Source function library. | |
| . /etc/rc.d/init.d/functions | |
| ROOT="app_path" | |
| USER="user" | |
| ENVIRONMENT="development" |
This file contains hidden or 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
| #config/initializers/redis.rb | |
| require 'redis' | |
| require 'redis/objects' | |
| REDIS_CONFIG = YAML.load( File.open( Rails.root.join("config/redis.yml") ) ).symbolize_keys | |
| dflt = REDIS_CONFIG[:default].symbolize_keys | |
| cnfg = dflt.merge(REDIS_CONFIG[Rails.env.to_sym].symbolize_keys) if REDIS_CONFIG[Rails.env.to_sym] | |
| $redis = Redis.new(cnfg) | |
| Redis::Objects.redis = $redis |
This file contains hidden or 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/env ruby | |
| require "date" | |
| five_days_ago = Date.parse(Time.now.to_s) - 5 | |
| IO.popen("hadoop fs -lsr /tmp").each_line do |line| | |
| permissions,replication,user,group,size,mod_date,mod_time,path = *line.split(/\s+/) | |
| if (mod_date) | |
| if Date.parse(mod_date.to_s) < five_days_ago | |
| puts line | |
| if permissions.split('')[0] == 'd' |