I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
import { | |
Account, | |
clusterApiUrl, | |
Connection, | |
PublicKey, | |
sendAndConfirmTransaction, | |
SystemProgram, | |
Transaction, | |
} from '@solana/web3.js'; |
curl http://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '{ | |
"jsonrpc": "2.0", | |
"id": 1, | |
"method": "getProgramAccounts", | |
"params": [ | |
"cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ", | |
{ | |
"encoding": "jsonParsed", | |
"filters": [ ] | |
} |
<!doctype html> | |
<html lang="eng"> | |
<head> | |
<meta charset="utf-8"/> | |
<title>useInitializer</title> | |
</head> | |
<body> | |
<script type="module"> | |
import { html, render, useState } from '//unpkg.com/htm/preact/standalone.mjs'; |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
MAX_DISTANCE_AWAY_IN_KM = 100.0 | |
RAD_PER_DEG = 0.017453293 | |
Rmiles = 3956 # radius of the great circle in miles | |
Rkm = 6371 # radius in kilometers, some algorithms use 6367 | |
Rfeet = Rmiles * 5282 # radius in feet | |
Rmeters = Rkm * 1000 # radius in meters | |
def haversine_distance( lat1, lon1, lat2, lon2 ) | |
dlon = lon2 - lon1 |
#Send image data to v4l2loopback using python | |
#Remember to do sudo modprobe v4l2loopback first! | |
#Released under CC0 by Tim Sheerman-Chase, 2013 | |
import fcntl, sys, os | |
from v4l2 import * | |
import time | |
import scipy.misc as misc | |
import numpy as np |
# given a directory or a set of files | |
# concatenate the binary files | |
# output a single binary file | |
# usage: | |
# ruby concatenate_binary_files "/xxx/xx/*.bin" "/xxx/xx.bin" | |
infiles = ARGV[0] | |
outpath = ARGV[1] | |
File.open(outpath, 'wb') do |outfile| |
Following script may be used for configuring complete and secure email server on fresh install of Ubuntu 18.04 LTS. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.