Skip to content

Instantly share code, notes, and snippets.

View elct9620's full-sized avatar
💦
Level up!!!

蒼時弦や elct9620

💦
Level up!!!
View GitHub Profile
# 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']
require 'socket'
require 'fiber'
class Selector
def initialize
@readable = {}
@writeable = {}
end
def wait_readable(io)
# forzen_string_literal: true
require 'net/http'
require 'awesome_print'
require 'json'
require 'benchmark'
# NOTE: ZH_TO_NUM BEGIN
ZH_NUM_MAP = {
'一' => 1,
require 'net/http'
require 'uri'
require 'socket'
require 'openssl'
require 'fiber'
require 'benchmark'
require 'benchmark/ips'
require 'benchmark/memory'
# :nodoc:
using UnityEngine;
public class GameInstance {
// Core Game Module
private Player.Controller _playerController;
public Player.Controller PlayerController {
retrun _playerController;
}
public GameInstance() {
# frozen_string_literal: true
require 'net/http'
require 'fiber'
require 'uri'
require 'openssl'
require 'socket'
require 'pp'
require 'benchmark/ips'
# frozen_string_literal: true
require 'net/http'
require 'fiber'
require 'socket'
require 'openssl'
require 'benchmark/ips'
require 'benchmark/memory'
@elct9620
elct9620 / prepend_socket.rb
Created March 18, 2019 06:22
Golang's io.TeeReader in Ruby implement use prepend
# frozen_string_literal: true
require 'socket'
# :nodoc:
module TeeReader
attr_reader :buffer
def initialize(*args)
super
@elct9620
elct9620 / Microsoft.PowerShell_profile.ps1
Last active June 14, 2019 19:23
Compile environment for mruby on Windows 10
$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 / README.md
Last active January 28, 2022 17:48
CloudFlare Workers Status API

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