A bad idea
To build the C-extension, from within the directory containing this project, run:
ruby extconf.rb
#!/bin/sh | |
function rbconfig () { | |
ruby -e'print RbConfig::CONFIG["'"$1"'"]' | |
} | |
bindgen \ | |
wrapper.h \ | |
-o "bindings.rs" \ | |
--allowlist-file ".*/ruby(/.+)?\.h" \ |
//! Rate limiter. | |
//! | |
//! This module contains a rate limiter based on the [Generic Cell Rate | |
//! Algorithm][gcra]. | |
//! | |
//! [gcra]: https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm | |
use std::{ | |
cmp::max, | |
collections::{HashMap, VecDeque}, |
use std::{env, error::Error, fs}; | |
fn main() -> Result<(), Box<dyn Error>> { | |
let mut args = env::args(); | |
let _name = args.next().ok_or("no program name")?; | |
let path = args.next().ok_or("missing path")?; | |
let input = fs::read_to_string(path)?; | |
let result = input |
require "set" | |
class Waker | |
def initialize(id, queue) | |
@id = id | |
@queue = queue | |
end | |
def wake | |
@queue << @id |
require "sinatra/base" | |
class App < Sinatra::Base | |
using SomeRefinementModule | |
# hack to enable refinements in templates | |
module CompiledTemplates | |
_binding = binding # get the current binding | |
# add a class_eval method to the binding that does an eval in the binding |
#!/bin/bash | |
if [[ -z "$1" ]]; then | |
echo "usage: $0 [user@]hostname" | |
exit 1 | |
fi | |
ssh -ND 1080 "$1" & | |
PID=$! |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<script src="tint.js"></script> | |
<script> | |
document.addEventListener("DOMContentLoaded", function () { | |
document.querySelectorAll("img").forEach(function (img) { | |
img.addEventListener("load", function () { | |
tint(img); |
require "net/https" | |
require "json" | |
GITHUB_OAUTH_TOKEN = <YOUR OAUTH TOKEN HERE> | |
GITHUB_ORG_NAME = <YOUR ORG> | |
def api_request(http, path) | |
request = Net::HTTP::Get.new(path) | |
request["Authorization"] = "token #{GITHUB_OAUTH_TOKEN}" | |
response = http.request(request) |
source "https://rubygems.org" | |
gem "ruby-opencv" |