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 goals.id, goals.parent_id, depth, goals.name FROM (WITH RECURSIVE crumbs AS ( | |
SELECT goals.*, -1 AS depth FROM goals WHERE id in (1) | |
UNION ALL | |
SELECT alias1.*, crumbs.depth + 1 FROM crumbs JOIN goals alias1 on alias1.parent_id = crumbs.id | |
WHERE crumbs.depth + 1 < 100000 | |
) SELECT * FROM crumbs) as goals WHERE goals.depth + 1 < 100002 ORDER BY depth, position; |
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
gem 'mail' |
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
$words_counter = {} | |
def process_token(token) | |
current_value = $words_counter[token] | |
if current_value | |
current_value.inc | |
else | |
$words_counter[token] = TokenCount.new(token) | |
end | |
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
mike@rbci:~$ psql -U postgres | |
psql (9.0.3) | |
Type "help" for help. | |
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
UPDATE 1 | |
postgres=# \c template0 | |
You are now connected to database "template0". | |
template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
UPDATE 1 |
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
package ru.examples; | |
import org.jgroups.JChannel; | |
import org.jgroups.blocks.locking.LockService; | |
import java.util.concurrent.locks.Lock; | |
public class SimpleLock { | |
/** You should provide one parameter - node 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
#!/usr/bin/env python | |
import sys | |
if __name__ == "__main__": | |
# Initialize a names dictionary as empty to start with. | |
# Each key in this dictionary will be a name and the value | |
# will be the number of times that name appears. | |
names = {} | |
# sys.stdin is a file object. All the same functions that | |
# can be applied to a file object can be applied to sys.stdin. |
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 | |
non empty {[Product].[All Products].Children} ON COLUMNS, | |
non empty {[Time].[Quarter].members, [Time].[Year].members} ON ROWS | |
FROM [Sales] |
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 'java' | |
class Profiler | |
def initialize(name) | |
@name = name | |
@metrics = {} | |
@start_times = {} | |
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
#path can be different. For Red Hat it is /opt/PostgreSQL/9.3/share/postgresql/tsearch_data | |
iconv -f koi8-r -t utf-8 < ru_RU.aff > /usr/share/postgresql/tsearch_data/russian.affix | |
iconv -f koi8-r -t utf-8 < ru_RU.dic > /usr/share/postgresql/tsearch_data/russian.dict |
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 * from | |
( | |
select | |
CASE | |
WHEN days < (current_date - date_trunc('year', current_date)) THEN days + interval '366 days' | |
ELSE days | |
END as position, birthday | |
from | |
(select birthday, birthday - date_trunc('year', birthday) as days from birthdays) bd_in_days | |
) bd |