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
def basic_auth | |
r = Nginx::Request.new | |
realm_name = r.var.realm_name | |
if r.headers_in["Authorization"].nil? | |
r.headers_out["WWW-Authenticate"] = %Q(Basic realm="#{realm_name}") | |
return Nginx::HTTP_UNAUTHORIZED | |
end | |
auth = r.headers_in["Authorization"] |
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
SERVER_NAME = "Trusterd" | |
SERVER_VERSION = "0.0.1" | |
SERVER_DESCRIPTION = "#{SERVER_NAME}/#{SERVER_VERSION}" | |
root_dir = "/home/vagrant/trusterd" | |
s = HTTP2::Server.new({ | |
:port => 8080, | |
:document_root => "#{root_dir}/htdocs", | |
:server_name => SERVER_DESCRIPTION, |
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 "digest" | |
password = 'user02' | |
key = '$apr1$' | |
salt = 'PD3O5t9N' | |
h1 = Digest::MD5.new | |
h1.update(password) | |
h1.update(key) | |
h1.update(salt) |
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
MRuby::Build.new do |conf| | |
toolchain :gcc | |
conf.gem :github => 'iij/mruby-digest' | |
conf.gem :github => 'iij/mruby-pack' | |
conf.gembox 'full-core' | |
end |
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
build: | |
host: | |
toolchain: gcc | |
debug: enable | |
gembox: default | |
gem: | |
- 'examples/mrbgems/c_and_ruby_extension_example' | |
- | |
'examples/mrbgems/c_extension_example': | |
cc: |
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 ruby | |
class Foo | |
def self.parse(src) | |
instance_eval(src) | |
end | |
class MRuby | |
class Gem | |
class Specification |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "curl/curl.h" | |
typedef struct { | |
char *m; | |
size_t size; | |
} Memory; |
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
// str - Rust https://doc.rust-lang.org/std/primitive.str.html | |
fn main() { | |
test_str(); | |
test_str_contains(); | |
test_str_find(); | |
test_str_splitn(); | |
} | |
fn test_str() { | |
assert_eq!("abc".len(), 3); |
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
# ref. https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#language-overview | |
page: | |
layout: portrait | |
margin: [0.75in, 1in, 0.75in, 1in] | |
size: Letter | |
base: | |
font_color: #333333 | |
font_family: Times-Roman | |
font_size: 12 | |
line_height_length: 17 |
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
source 'https://rubygems.org' | |
gem "faraday" | |
gem "faraday_middleware" | |
gem "thor" |