sudo yum install ncurses-devel
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
$ gem -v | |
2.0.3 | |
$ gem list rubygems-update | |
$ gem uninstall -v 2.0.3 rubygems-update | |
$ gem install -v 1.8.24 rubygems-update | |
$ update_rubygems | |
$ gem -v | |
1.8.24 |
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
import contextlib | |
import pytest | |
from unittest.mock import patch | |
class A(object): | |
def say(self, msg): | |
return f'A say {msg!r}.' | |
@contextlib.contextmanager |
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
r53 = AWS::Route53.new( | |
:access_key_id => 'aws-key-id', | |
:secret_access_key => 'aws-secret-key') | |
response = r53.client.list_resource_record_sets( | |
:hosted_zone_id => "zone-id", | |
:start_record_name => 'xxx.example.com', | |
:start_record_type => 'CNAME' | |
) | |
puts response[:resource_record_sets].map{|r| r[:name]} |
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
select trunc(startwork), count(distinct xid) from stl_commit_stats where xid > 0 group by trunc(startwork) order by 1; |
- Get Oracle instant client for MacOSX
- Go to the download site - http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
- Download "instantclient-basic-macos.x64-12.1.0.2.0.zip"
- Download "instantclient-sqlplus-macos.x64-12.1.0.2.0.zip"
- Download "instantclient-sdk-macos.x64-12.1.0.2.0.zip"
- Unarchive downloaded zip files into a same directory
- ex:
$HOME/Downloads/instantclient_12_1
- Create
install.sh
and copy the following code and past it on that file.
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
# Duplicate record delete query generator for Amazon Redshift | |
# By running a generated query, duplicate rows in a specified table will be removed. | |
# | |
# Usage: | |
# ruby delete_dup_records_redshift.rb <table-name> <priary-keys-with-comma-separator> | |
unless ARGV.count == 2 | |
puts <<EOT | |
Usage: | |
ruby delete_dup_records_redshift.rb <table name> <primary keys> |
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
-- Get primary keys for "fsb_schema_7_7379bca4"."m_test_table_multi_pk" | |
SELECT | |
f.attnum AS number, | |
c.relname AS table_name, | |
f.attname AS column_name | |
FROM pg_attribute f | |
JOIN pg_class c ON c.oid = f.attrelid | |
JOIN pg_type t ON t.oid = f.atttypid | |
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum |
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
RSpec::Matchers.define :terminate do |code| | |
actual = nil | |
def supports_block_expectations? | |
true | |
end | |
match do |block| | |
begin | |
block.call |
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
CREATE USER r_only_user identified by 'password'; | |
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'%' IDENTIFIED BY 'password'; | |
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'localhost' IDENTIFIED BY 'password'; | |
FLUSH PRIVILEGES; |
NewerOlder