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
package main | |
import ( | |
"compress/gzip" | |
"io" | |
"log" | |
"net" | |
) | |
type hello struct { |
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
package main | |
import ( | |
"compress/gzip" | |
"io" | |
"log" | |
"net" | |
) | |
func main() { |
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/bin/env ruby | |
require 'yaml' | |
def puts_sh_kv(key, value) | |
escaped_value = value.gsub(/"/, '\\"') | |
puts %(function #{key}() { echo "#{escaped_value}"; }) | |
end | |
def print_sh(data, key_prefix: '') | |
data.each do |key, value| |
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/bin/env ruby | |
require 'optparse' | |
# @param bytes [String] Byte sequence as needle. | |
# @param io [IO] IO object as haystack. | |
# @param max [Integer, nil] Stop search when `max` number of `bytes` are found. | |
# @return [Array<Integer>] | |
def search(bytes, io, max = nil) | |
buf_size = bytes.size * 10 | |
buf = '' |
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
#include "foo.h" | |
int get_foo_a() { return foo; } |
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
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"net/http/httptest" |
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
package main | |
import ( | |
"fmt" | |
) | |
func その名は(名探偵, コナン string) { | |
fmt.Println(名探偵 + "=" + コナン) | |
} |
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
class SemVer | |
include Comparable | |
attr_accessor :major, :minor, :patch, :prerelease, :build_metadata | |
@@re = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?(?:\+((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?$/ | |
def initialize(major, minor, patch, prerelease = "", build_metadata = "") | |
@major = major.to_i | |
@minor = minor.to_i |
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
#!/bin/bash | |
set -eu | |
ruby -ryaml -rjson -e "puts JSON.dump(YAML.load(STDIN))" |
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
#include <iostream> | |
#include <memory> | |
std::shared_ptr<int*> CreatePointerNG(int v) { | |
auto foo = std::make_shared<int>(v); | |
return std::make_shared<int*>(foo.get()); | |
} | |
std::shared_ptr<int*> CreatePointerOK(int v) { | |
auto foo = std::make_shared<int>(v); |