Skip to content

Instantly share code, notes, and snippets.

View msg7086's full-sized avatar

Xinyue Lu msg7086

  • Greater Portland, OR
  • 13:59 (UTC -07:00)
View GitHub Profile
@msg7086
msg7086 / v2ex-535284.rb
Created February 15, 2019 05:42
douyu ts concat
require 'titleize'
require 'colorize'
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
$dir = Rake.original_dir.encode(Encoding::UTF_8)
Dir.chdir($dir)
puts "Executing in (#{$dir})..."
input = [
[1,2,3],
[2,3],
[3,5],
[10,15]
]
# 二级引用
class Ref
attr_accessor :obj
From: msg7086 <[email protected]>
Date: Sun, 8 Apr 2018 22:22:22 -0400
Subject: [PATCH] Also try to set TLSv1.3 ciphers
---
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 88a6dbe..5ac0ec6 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
#!ruby
require 'rake'
require 'json'
require 'colorize'
@db = File.expand_path '~/task.txt'
@stop = File.expand_path '~/stop.txt'
def load_task
File.readlines(@db).map { |t| JSON.parse(t.chomp, :symbolize_names => true) }
@msg7086
msg7086 / gencsr.rb
Created October 25, 2016 07:26
Generate pair of ecc & rsa SSL certificates
#!/usr/bin/env ruby
require 'rake'
include FileUtils
include Rake
domain=ARGV.first
commonname=domain
country='US'
require 'digest'
md5 = '3bed22f7f496e84b035a996522baa7594c27c7e5718a78bfddf9012904b70eb755d67f90c8de149ead7ee674b024f38c216642030c2d54cb1dd657dd66342c99c239f3c31fd399fc052a9b7861f2073d2b9f47811dd77fd544d570c34bf5f349d110389979571714694a5054238465ca38ba26c25fb1a32b4d0a3b93666b09b3'
prefix = Digest::MD5.hexdigest 'v2ex'
str = ''
md5.scan(/.{32}/) { |m| str += [*'0'..'9',*'A'..'Z',*'a'..'z'].find { |s| Digest::MD5.hexdigest(prefix + str + s + Digest::MD5.hexdigest(str + s)) == m } }
puts str #=> csdaixie
(ebay) Intel Xeon CPU E5-2670 2.60GHz Eight-Core 2 $140
(newegg) ASRock EP2C602-4L/D16 SSI EEB Server Motherboard $310
(ebay) 128GB (16x8GB) DDR3 ECC Reg $330
(newegg/ama) EVGA 650 GQ Power Supply $80
(newegg/ama) Phanteks Enthoo Pro $110
Corsair Hydro Series Liquid CPU Cooler H60 2 $120
HDDs
Total $1,090
@msg7086
msg7086 / sinatra-1059.rb
Created December 30, 2015 21:35
/sinatra/sinatra/pull/1059
def a(unsafe)
chars = unsafe.split(//).map! do |char|
if char =~ /[A-Z]/
char <<= char.tr('A-Z', 'a-z')
end
char
end
end
def b(unsafe)
require 'rake'
require 'time'
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
class Timestamp
attr_reader :from, :to
def initialize from, to
@from = from.to_i
def get_list sort: 'new', cate: nil, type: nil, ch: nil, kind: 'normal', cid: 0, page: 0, per_page: 10
data = Soft
pcate = root_key && cached_get(root_key)
data = data.where(['charIndex(?, categoryPath) > 0', "/#{pcate.ID}/"]) if !pcate.nil?
data = data.where(['charIndex(?, categoryPath) > 0 or charIndex(?, categoryPath) > 0)', *ch_args]) if !ch_args.empty?
if cate
cate_ent = cached_get(root_key, cate)
data = data.where(category_id: cate_ent.ID)
end
cid = cid.to_i