Skip to content

Instantly share code, notes, and snippets.

蒼時弦や elct9620

Block or report user

Report or block elct9620

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elct9620
elct9620 / README.md
Last active Jul 5, 2019
CloudFlare Workers Status API
View README.md

CloudFlare Workers as Status API

In most case, the CloudFlare SLA is greater than our server. So, we can use it as a simple uptime checker.

Usage

  1. Deploy index.js to your CloudFlare Workers, and bind KV which you save the status.
  2. Add updater.rb to your server, and setup cron job to run it
  3. Get node status on any static page with https://your-worker.workers.dev/?node[]=name to fetch node status
@elct9620
elct9620 / Microsoft.PowerShell_profile.ps1
Last active Jun 14, 2019
Compile environment for mruby on Windows 10
View Microsoft.PowerShell_profile.ps1
$vsWhere = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'
$vsInstallPath = &($vsWhere) -latest -property installationPath
if ($vsInstallPath -and (test-path "$vsInstallPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$vsInstallPath\Common7\Tools\vsdevcmd.bat`" -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
set-content env:\"$name" $value
}
}
@elct9620
elct9620 / prepend_socket.rb
Created Mar 18, 2019
Golang's io.TeeReader in Ruby implement use prepend
View prepend_socket.rb
# frozen_string_literal: true
require 'socket'
# :nodoc:
module TeeReader
attr_reader :buffer
def initialize(*args)
super
View fiber-http-enumerable.rb
# frozen_string_literal: true
require 'net/http'
require 'fiber'
require 'socket'
require 'openssl'
require 'benchmark/ips'
require 'benchmark/memory'
View async-http-fiber.rb
# frozen_string_literal: true
require 'net/http'
require 'fiber'
require 'uri'
require 'openssl'
require 'socket'
require 'pp'
require 'benchmark/ips'
View singleton.cs
using UnityEngine;
public class GameInstance {
// Core Game Module
private Player.Controller _playerController;
public Player.Controller PlayerController {
retrun _playerController;
}
public GameInstance() {
View async-http.rb
require 'net/http'
require 'uri'
require 'socket'
require 'openssl'
require 'fiber'
require 'benchmark'
require 'benchmark/ips'
require 'benchmark/memory'
# :nodoc:
View plurk-salary-crawler.rb
# forzen_string_literal: true
require 'net/http'
require 'awesome_print'
require 'json'
require 'benchmark'
# NOTE: ZH_TO_NUM BEGIN
ZH_NUM_MAP = {
'' => 1,
View fiber.rb
require 'socket'
require 'fiber'
class Selector
def initialize
@readable = {}
@writeable = {}
end
def wait_readable(io)
View config.ru
# Start Command: rackup
require 'socket'
# Initialize Socket -> Pure Data
pd = TCPSocket.new 'localhost', 3000
# Create HTTP Server
app = Proc.new do |env|
# /?Do=1&Re=0
query = env['QUERY_STRING']
You can’t perform that action at this time.