#!/usr/bin/env bash
# Assuming OS X Yosemite 10.10.4
# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
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
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 1; | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..12.57 rows=1 width=7138) (actual time=198.759..198.760 rows=1 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=198.758..198.758 rows=1 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=198.743..198.743 rows=1 loops=1) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=101.312..198.737 rows=1 loops=1) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 |
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
-- ]-inf;today[ overlaps [today,+inf[ | |
# select ('-infinity'::timestamp, now()) overlaps (now(), 'infinity'::timestamp) ; | |
overlaps | |
---------- | |
f | |
(1 row) | |
-- ]-inf;tomorrow[ overlaps [today,+inf[ | |
# select ('-infinity'::timestamp, now() + interval '1 day') overlaps (now(), 'infinity'::timestamp) ; | |
overlaps |
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
require 'formula' | |
class Kindlegen < Formula | |
url 'http://s3.amazonaws.com/kindlegen/KindleGen_Mac_i386_v2_7.zip' | |
homepage 'http://www.amazon.com/gp/feature.html?docId=1000234621' | |
sha256 'e75aaf4a70875eedbcd69c6f44c22bbadf5a48a81de5130947df4698c34c6597' | |
version '2.7' | |
skip_clean 'bin' |
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 a table | |
[email protected]/19678=# create table ary(foo text); insert into ary values ('hello world'),('foo bar baz'); select * from ary; | |
CREATE TABLE | |
INSERT 0 2 | |
foo | |
------------- | |
hello world | |
foo bar baz | |
(2 rows) |
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
λ /usr/local/pgsql/bin/psql | |
psql (9.5devel) | |
Type "help" for help. | |
[email protected]/49942=# create table foo(bar varchar(4), baz varchar(2)); | |
CREATE TABLE | |
[email protected]/49942=# insert into foo values ('foo!', 'ok'); | |
INSERT 0 1 |
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
>> $-w=true | |
=> true | |
>> @a ||= @b | |
(irb):2: warning: instance variable @b not initialized | |
=> nil | |
>> @c = @c || @d | |
(irb):3: warning: instance variable @c not initialized | |
(irb):3: warning: instance variable @d not initialized | |
=> nil |
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
irb(main):001:0> $-w = true | |
=> true | |
irb(main):002:0> @foo ||= true | |
=> true | |
irb(main):003:0> @bar &&= true | |
(irb):3: warning: instance variable @bar not initialized | |
=> nil |
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
require 'benchmark/ips' | |
class Foo | |
def bar | |
# "Foo#bar" | |
end | |
end | |
module Bar | |
def bar |
The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c
sample by using LLVM:
$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp