% psql -c 'create table t (x integer not null)'
CREATE TABLE
% psql -c 'insert into t (x) values (0)'
INSERT 0 1
% psql -c 'select * from t'
x
---
0
(1 row)
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
fn main() { | |
for j in [ | |
r#"{"type": "foo", "subtype": "bar", "a": 1}"#, // Deserialize to Foo(Bar(...)) | |
r#"{"type": "foo", "subtype": "baz", "b": "1"}"#, // Deserialize to Foo(Baz(...)) | |
r#"{"type": "foo", "c": true}"#, // Deserialize to Foo(Qux(...)) | |
r#"{"type": "foo", "subtype": "other", "c": true}"#, // Error | |
r#"{"type": "hoge", "subtype": "fuga", "d": 2}"#, // Deserialize to Hoge(Fuga(...)) | |
r#"{"type": "hoge", "subtype": "piyo", "e": 3}"#, // Deserialize to Hoge(Piyo(...)) | |
] { | |
let s = serde_json::from_str::<S>(j); |
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
std.join(' + ', [std.format('{ xs+: [%d] }', i) for i in std.range(0, 10000)]) |
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
{ | |
"items": [ | |
{"type": "A", "foo": "bar"}, | |
{"type": "B", "hoge": "fuga"} | |
] | |
} |
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
use rayon::prelude::*; | |
fn main() { | |
std::thread_local!(static CLIENT: std::cell::RefCell<Option<reqwest::Client>> = std::cell::RefCell::new(None)); | |
rayon::ThreadPoolBuilder::new() | |
.num_threads(8) | |
.build_scoped( | |
|thread| { | |
CLIENT.with(|c| { | |
*c.borrow_mut() = Some(reqwest::Client::new()); |
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
extern crate env_logger; | |
extern crate rusoto_ec2; | |
fn main() { | |
use rusoto_ec2::Ec2; | |
env_logger::init(); | |
// my VPC case in ap-northeast-1 region | |
let image_id = "ami-7a1be605"; |
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 'json' | |
require 'net/http' | |
require 'hako/script' | |
module Hako | |
module Scripts | |
class JenkinsTag < Script | |
JENKINS_BASE = 'https://jenkins.example.com' | |
TARGET_TAG = 'jenkins' |
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
extern crate rusoto_core; | |
extern crate rusoto_sqs; | |
extern crate rusoto_s3; | |
extern crate rusoto_route53; | |
fn main() { | |
use rusoto_sqs::Sqs; | |
use rusoto_s3::S3; | |
use rusoto_route53::Route53; |
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 main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
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 'set' | |
class InferType | |
def self.run(&block) | |
infer_type = InferType.new | |
infer_type.start | |
block.call | |
ensure | |
infer_type.finish | |
end |
NewerOlder