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
BaseSixtyFourDigits ← "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" | |
Hex ← ⌅( | |
⊏⊙HexDigits°⋯≡⇌↯∞_4 | |
| ≡⇌⋯⊗⊙HexDigits) | |
B₆₄ ← ⌅( | |
⊏⊙BaseSixtyFourDigits°⋯≡⇌↯∞_6 | |
| ⋯⊗⊙BaseSixtyFourDigits | |
) |
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
with test(round) as ( | |
select 0 | |
union all | |
select round+1 from test where round <= 20 | |
) | |
select round | |
from | |
-- delete the subselect line and it gives the expected error | |
-- "Error: near line 1: Catalog Error: Table with name handshake does not exist!" |
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 | |
group_concat(ingredient, ',') | |
from ( | |
select | |
ingredient, | |
allergen | |
from | |
named_allergens | |
order by allergen | |
); |
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
-- Preprocessing the input into a csv e.g. 1,3,a,abcde | |
-- Creating table: | |
CREATE TABLE aoc_2(lower int4, upper int4, letter char, password varchar); | |
--Part 1: | |
SELECT | |
count(*) | |
FROM | |
aoc_2 |
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 TinyInjector { | |
public <T> T get(Class<T> klass) { | |
try { | |
return klass.newInstance(); | |
} catch (InstantiationException | IllegalAccessException e) { | |
throw new RuntimeException(e); | |
} | |
} | |
} |
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
import java.util.function.Function; | |
// https://en.wikipedia.org/wiki/Result_type | |
public sealed interface Result<LEFT, RIGHT> permits Result.Success, Result.Failure { | |
// Both functions have a common result supertype | |
// e.g. `T` can be a `Result<X,Y>` or a resolved type like a `String` / `Request` | |
<T, L2 extends T, R2 extends T> T either(Function<LEFT, L2> left, Function<RIGHT, R2> right); | |
default <T> T then(Function<Result<LEFT, RIGHT>, T> function) { |
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
#[link(name = "sqlite3", kind="static")] | |
extern { | |
fn sqlite3_libversion_number() -> i8; | |
} | |
fn main() { | |
let x = unsafe { sqlite3_libversion_number() }; | |
println!("Sqlite3 lib version number is {}!", x); // 2! | |
} |
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 ansible-playbook | |
- hosts: blog | |
sudo: yes | |
gather_facts: false | |
tasks: | |
- name: Copy blog across | |
synchronize: src=./blog dest=/var/www/blog | |
notify: |
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
# regions | |
do_regions_sfo1: 3 | |
do_regions_nyc2: 4 | |
do_regions_ams2: 5 | |
do_regions_sgp1: 6 | |
do_regions_lon1: 7 | |
# sizes | |
do_sizes_32gb: 60 | |
do_sizes_16gb: 61 |
NewerOlder