Skip to content

Instantly share code, notes, and snippets.

@Hexa
Hexa / gist:51b9dbb9137a5d5c0512
Created February 11, 2015 12:33
CentOS 6 に PyPy をインストール

各ライブラリのインストール

$ cat /etc/redhat-release
CentOS release 6.6 (Final)
$ sudo yum -y install gcc make libffi-devel pkgconfig zlib-devel bzip2-devel sqlite-devel ncurses-devel expat-devel openssl-devel

Python 2.7.9

#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'ethernet'
ETHER_NAME = 'lxcbr0'
socket = Ethernet.socket(ETHER_NAME, 0x0806)
OPERATION = 0x0002
$ curl -X GET http://docker-registry.example.com:5000/v1/search 2> /dev/null | jq .
{
"results": [
{
"name": "library/ubuntu-14.04.base",
"description": ""
},
{
"name": "library/ubuntu-13.10.base",
"description": ""
location / {
set $aws_access_key_id "";
set $aws_secret_access_key "";
set $bucket_name "bucket";
mruby_set_code $date "Nginx::Time.http_time(Nginx::Time.time)";
mruby_set_code $authorization '
content_md5 = ""
content_type = ""
irb(main):001:0> RUBY_DESCRIPTION
=> "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]"
irb(main):002:0> require 'openssl'
=> true
irb(main):003:0> extension_factory = OpenSSL::X509::ExtensionFactory.new
=> #<OpenSSL::X509::ExtensionFactory:0x007f870098d800 @config=nil>
irb(main):004:0> extension_factory.create_ext('subjectAltName', "DNS:www.example.com").value
=> "DNS:www.example.com"
irb(main):005:0> extension_factory.create_ext('subjectAltName', "DNS:www\0.example.com").value
=> "DNS:www"
@Hexa
Hexa / gist:4328513
Created December 18, 2012 14:36
cRLDistributionPoints and issuingDistributionPoint
require 'openssl'
cRLDistributionPoints=
OpenSSL::ASN1::Sequence.new([
OpenSSL::ASN1::Sequence.new([
OpenSSL::ASN1::ASN1Data.new([
OpenSSL::ASN1::ASN1Data.new([
OpenSSL::ASN1::ASN1Data.new(
distributionPointName = "http://example.com/example.crl",
6, :CONTEXT_SPECIFIC
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha1WithRSAEncryption
Issuer: CN=CA
Validity
Not Before: Dec 16 04:56:09 2012 GMT
Not After : Dec 16 04:56:09 2012 GMT
Subject: CN=CA
@Hexa
Hexa / gist:4002797
Created November 2, 2012 17:09
OpenSSL::X509::ExtensionFactory#create_ext の結果の違い
## ruby 2.0.0dev
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> ef = OpenSSL::X509::ExtensionFactory.new
=> #<OpenSSL::X509::ExtensionFactory:0x007fd72213f6e0 @config=nil>
irb(main):003:0> ef.create_ext('basicConstraints', 'CA:TRUE, pathlen:1', true)
=> #<OpenSSL::X509::Extension:0x007fd7221245e8>
## ruby 1.9.3p194
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'fog'
name = ARGV[0]
conn =Fog::Compute.new({
:provider => 'XenServer',
:xenserver_url => '192.168.1.2',