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
postgresql: | |
image: postgres-image | |
mem_limit: 4001000000 | |
ports: | |
- "5432:5432" | |
volumes: | |
- /opt/docker/data/postgresql/9.4/main:/var/lib/postgresql/data | |
zookeeper: | |
image: wurstmeister/zookeeper | |
mem_limit: 256000000 |
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
A string S consisting of N characters is called properly nested if: | |
S is empty; | |
S has the form "(U)" where U is a properly nested string; | |
S has the form "VW" where V and W are properly nested strings. | |
For example, string "(()(())())" is properly nested but string "())" isn't. | |
Write a function: | |
class Solution { |
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 an index with an analyzer "myindex" | |
curl -X PUT localhost:9200/myindex -d ' | |
{ | |
"settings" : {` | |
"index":{ | |
"number_of_replicas":0, | |
"number_of_shards":1, | |
"analysis":{ | |
"analyzer":{ | |
"first":{ |
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
vltsu@vltsu-pc:~/Desktop$ hadoop jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar grep input output23 'dfs[a-z.]+' | |
15/03/21 19:46:30 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032 | |
15/03/21 19:46:30 WARN mapreduce.JobSubmitter: No job jar file set. User classes may not be found. See Job or Job#setJar(String). | |
15/03/21 19:46:30 INFO input.FileInputFormat: Total input paths to process : 4 | |
15/03/21 19:46:30 INFO mapreduce.JobSubmitter: number of splits:4 | |
15/03/21 19:46:30 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1426946641895_0004 | |
15/03/21 19:46:30 INFO mapred.YARNRunner: Job jar is not present. Not adding any jar to the list of resources. | |
15/03/21 19:46:30 INFO impl.YarnClientImpl: Submitted application application_1426946641895_0004 | |
15/03/21 19:46:30 INFO mapreduce.Job: The url to track the job: http://vltsu-pc:8088/proxy/application_1426946641895_0004/ | |
15/03/21 19:46:30 INFO mapreduce.Job: Running job: job_1426946641895_0004 |
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
sudo tcpdump -i lo0 -A -s 0 'tcp port 8081 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' // show http request and headers for localhost on port 8081 |
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
@Entity | |
public class Employee { | |
@Id long empId; | |
String empName; | |
... | |
} | |
public class DependentId { | |
String name; // matches name of @Id attribute | |
long emp; // matches name of @Id attribute and type of Employee PK |
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
// determine field type | |
if f.getType().isAssignableFrom(String.class) | |
if f.getType().equals(boolean.class) | |
if f.getType().isAssignableFrom(Date.class) | |
// if object is string | |
if (myObject instanceof String) { ... } |
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
# Capistrano configuration | |
# | |
# require 'new_relic/recipes' - Newrelic notification about deployment | |
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production. | |
# set :deploy_via, :remote_cache - fetch only latest changes during deployment | |
# set :normalize_asset_timestamps - no need to touch (date modification) every assets | |
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment) | |
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP | |
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
class SetDefaultCanonicalUrlsForCollects < ActiveRecord::Migration | |
def change | |
Account.find_in_batches(:batch_size => 300) do |accounts| | |
execute "commit;" | |
accounts.each do |account| | |
execute " | |
UPDATE collects | |
SET is_canonical_url = true | |
WHERE id in ( | |
SELECT DISTINCT ON (product_id) id FROM collects WHERE product_id IN ( |
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
require 'csv' | |
namespace :users do | |
desc "Import users from csv" | |
task :import => :environment do | |
path = ENV.fetch("CSV_FILE") { | |
File.join(File.dirname(__FILE__), *%w[.. .. db data users.csv]) | |
} | |
CSV.foreach(path, headers: true, header_converters: :symbol) do |row| | |
User.create(row.to_hash) |
NewerOlder