Skip to content

Instantly share code, notes, and snippets.

Avatar

Kohei Suzuki eagletmt

View GitHub Profile
View bench.jsonnet
std.join(' + ', [std.format('{ xs+: [%d] }', i) for i in std.range(0, 10000)])
View transaction.md
% 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)
@eagletmt
eagletmt / input.json
Created Apr 13, 2020
How to deserialize internally tagged JSON in Go?
View input.json
{
"items": [
{"type": "A", "foo": "bar"},
{"type": "B", "hoge": "fuga"}
]
}
View main.rs
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());
View main.rs
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";
View jenkins_tag.rb
require 'json'
require 'net/http'
require 'hako/script'
module Hako
module Scripts
class JenkinsTag < Script
JENKINS_BASE = 'https://jenkins.example.com'
TARGET_TAG = 'jenkins'
View main.rs
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;
@eagletmt
eagletmt / main.go
Last active Oct 20, 2021
List installable Android SDK packages (similar to sdkmanager --verbose --list)
View main.go
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"log"
"net/http"
)
View infer_type.rb
require 'set'
class InferType
def self.run(&block)
infer_type = InferType.new
infer_type.start
block.call
ensure
infer_type.finish
end
View include.patch
diff -ur openssh-7.3p1.orig/readconf.c openssh-7.3p1/readconf.c
--- openssh-7.3p1.orig/readconf.c 2016-07-28 07:54:27.000000000 +0900
+++ openssh-7.3p1/readconf.c 2016-08-02 01:13:28.182685601 +0900
@@ -1500,8 +1500,7 @@
oactive ? "" : " (parse only)");
r = read_config_file_depth(gl.gl_pathv[i],
pw, host, original_host, options,
- flags | SSHCONF_CHECKPERM |
- (oactive ? 0 : SSHCONF_NEVERMATCH),
+ flags | SSHCONF_CHECKPERM,