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
| def search(tp_id1, rule_id1, tp_id2, rule_id2) | |
| ActiveRecord::Base.connection.execute("SELECT * FROM tracked_points, rules WHERE (tracked_points.id = #{tp_id1} AND rules.id = #{rule_id1}) OR (tracked_points.id = #{tp_id2} AND rules.id = #{rule_id2})") | |
| end |
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
| deployer@arcsite:~/apps/arcsite/current$ ls -l ~/.rvm/wrappers/arcsite | |
| lrwxrwxrwx 1 deployer sudo 58 Sep 24 19:12 /home/deployer/.rvm/wrappers/arcsite -> /home/deployer/.rvm/wrappers/ruby-1.9.3-p392@arcsite_mysql | |
| deployer@arcsite:~/.rvm/wrappers/arcsite$ ls -l | |
| total 116 | |
| -rwxr-xr-x 1 deployer sudo 328 Sep 24 19:13 bundle | |
| -rwxr-xr-x 1 deployer sudo 325 Sep 24 19:13 cap | |
| -rwxr-xr-x 1 deployer sudo 328 Sep 24 19:13 capify | |
| -rwxr-xr-x 1 deployer sudo 325 Sep 24 19:13 dbf | |
| -rwxr-xr-x 1 deployer sudo 325 Sep 24 19:13 erb |
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 bash | |
| su deployer - -c "service unicorn_arcsite start"; |
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
| upstream unicorn { | |
| server unix:/tmp/unicorn.arcsite.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80 default deferred; | |
| # server_name example.com; | |
| root /home/deployer/apps/arcsite/current/public; | |
| location ^~ /assets/ { |
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
| RAILS_ROOT=/home/deployer/apps/arcsite/current | |
| UNICORN=/home/deployer/.rvm/wrappers/arcsite/unicorn |
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
| 1.9.3-p392 :001 > Zone.find(455).touch | |
| (12.3ms) SELECT * FROM geometry_columns WHERE f_table_name='zones' | |
| Zone Load (32.6ms) SELECT "zones".* FROM "zones" WHERE "zones"."id" = $1 LIMIT 1 [["id", 455]] | |
| SQL (0.9ms) UPDATE "zones" SET "updated_at" = '2013-09-03 19:44:19.881546' WHERE "zones"."id" = 455 | |
| => true | |
| //notice that the string "hey there, I'm cleared" is not printed | |
| 1.9.3-p392 :002 > Zone.cached_find 455 | |
| Zone Load (0.4ms) SELECT "zones".* FROM "zones" WHERE "zones"."id" = $1 LIMIT 1 [["id", 455]] |
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
| SELECT DISTINCT ON(tracked_points.worker_id) tracked_points.* FROM "tracked_points" WHERE "tracked_points"."location_id" = 15 ORDER BY tracked_points.worker_id, tracked_points.recorded_at DESC |
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
| INSERT INTO locations (worker_id, site_id, recorded_at, created_at, updated_at) SELECT worker_id, site_id, recorded_at + interval '310 seconds', now(), now() FROM locations WHERE worker_id = 86 |
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
| # From remote | |
| Connect(home_base, username, password) | |
| last_id_replicated = SELECT highest_replicated_id FROM replication_information WHERE computer = self.name | |
| Connect(local_db, username, password) | |
| to_replicate = local_machine.SELECT * FROM tracked_points WHERE id > last_id_replicated | |
| to_replicate.every_thousand_records | |
| start_transaction | |
| INSERT INTO home_base.big_table (computer_name, x, y, recorded_at) VALUES (self.name, thousand_records.x, thousand_records.y, thousand_records.recorded_at) | |
| UPDATE replication_information SET last_updated_at = Time.now, highest_replicated_id = thousand_records.last.id WHERE computer_name = self.name |
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 public.conditions | |
| ( | |
| id integer NOT NULL DEFAULT nextval('conditions_id_seq'::regclass), | |
| parameter_id integer, | |
| parameter_type character varying(255), | |
| rule_id integer, | |
| created_at timestamp with time zone NOT NULL, | |
| updated_at timestamp with time zone NOT NULL, | |
| CONSTRAINT conditions_pkey PRIMARY KEY (id) | |
| ) |