Skip to content

Instantly share code, notes, and snippets.

View Ravenstine's full-sized avatar

Ten Bitcomb Ravenstine

View GitHub Profile
@Ravenstine
Ravenstine / aws-couchdb-setup.md
Last active April 19, 2024 15:03
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

@Ravenstine
Ravenstine / how_to_host_a_rails_app_on_a_home_server.md
Last active February 27, 2024 00:26
How to Host a Rails App on a Home Server

Host to Host a Rails App on a Home Server

Hosting services like Heroku and Amazon EC2 are nice. That is, until they cost money. Some things are worth running on your own hardware, especially when the cost and Terms of Service requirements outweigh the expense of rolling your own hosting.

I am writing this because I recently had to figure all this out in order to host a personal blog off a Raspberry Pi, and I thought I'd share what I learned. This guide assumes that you already know how to install Ruby and you know how to use Rails. If you don't, look those up first before coming back to this guide.

Prerequisites

  • Ruby >=2.0
  • Rails >=4.0
  • Nginx
@Ravenstine
Ravenstine / how-to-run-yggdrasil-in-docker.md
Created September 29, 2023 20:48
How To Run Yggdrasil In Docker

How To Run Yggdrasil In Docker

Want to run Yggdrasil in a Docker container? This is how you can do it.

The keys to getting it working are the following:

  • Give the container access to the TUN interface of the host (or the VM guest in the case of Docker Machine or Docker for Mac)
  • Enable IPv6
  • Assign a dedicated MAC address
@Ravenstine
Ravenstine / docker-shebang.md
Created December 4, 2023 12:37
Shebang To Run Script In Docker Container

Shebang To Run Script In Docker Container

Docker

#!/usr/bin/env docker run --rm alpine:3.18.3 /bin/sh

echo "OS: $(uname -s)"
@Ravenstine
Ravenstine / vbscript_wine.md
Last active August 18, 2023 19:43
Installing VBScript in Wine (Linux)

How to Run VBScripts in Wine

It's very easy but not straight-forward or documented anywhere.

First, install Wine 1.6.2. This version probably isn't required, but it's the version that currently ships with Debian Jessie and it works with VBScript.

Install Winetricks and use it to add the following libraries:

  • wsh57
@Ravenstine
Ravenstine / apple-screen-sharing-w-sound.md
Last active August 18, 2022 21:55
Apple Screen Sharing w/ Sound

Apple Screen Sharing w/ Sound

macOS comes with a remote desktop application called "Screen Sharing." It is essentially a VNC server and client, and it works really well.

Unfortunately, VNC protocol doesn't include sound, hence neither Screen Sharing for macOS or other VNC clients.

I needed a way to be able to hear various application notifications through Screen Sharing, as well as watch videos or any media hosted by my company. To solve this problem, I came up with a way to support forwarding sound between two Macs.

The idea is to use BlackHole to capture output audio, record it with SoX, and pipe the output to the play command (from SoX) on the remote client. It's not an ideal setup, especially since there's about a second of lag, but it's sufficient if you need to remotely watch videos or hear sound for whatever reason.

@Ravenstine
Ravenstine / video-to-gif.sh
Created July 15, 2021 19:43
Convert video to gif with FFMpeg
ffmpeg -i input.mov -vf "fps=15,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
@Ravenstine
Ravenstine / tailwind-colors.css
Created July 23, 2022 01:57
Tailwind colors as CSS variables
:root {
--color-blue-gray-50: hsl(210.0, 40.0%, 98.04%);
--color-blue-gray-100: hsl(210.0, 40.0%, 96.08%);
--color-blue-gray-200: hsl(214.29, 31.82%, 91.37%);
--color-blue-gray-300: hsl(212.73, 26.83%, 83.92%);
--color-blue-gray-400: hsl(215.0, 20.22%, 65.1%);
--color-blue-gray-500: hsl(215.38, 16.32%, 46.86%);
--color-blue-gray-600: hsl(215.29, 19.32%, 34.51%);
--color-blue-gray-700: hsl(215.29, 25.0%, 26.67%);
--color-blue-gray-800: hsl(217.24, 32.58%, 17.45%);
@Ravenstine
Ravenstine / best-buy-sell-price.js
Last active June 28, 2022 16:02
best-buy-sell-price.js
function bestBuyAndSellPrices(stockPrices) {
let buyDay = null;
let sellDay = null;
let buyPrice = typeof stockPrices[0] !== 'number' ? null : stockPrices[0];
let sellPrice = buyPrice;
stockPrices.forEach((currentBuyPrice, i) => {
const prevPrice = stockPrices[i - 1];
const nextPrice = stockPrices[i + 1];
const isBuyPrice = ((currentBuyPrice - prevPrice) < 0 && (nextPrice - currentBuyPrice) >= 0);
@Ravenstine
Ravenstine / socket.py
Last active April 26, 2022 04:37
Maya Socket Server
import socket
import sys
from threading import Thread
import maya.cmds
import maya.utils
def server_start():
server_address = '0.0.0.0', 8765 # Usage: server.py <port>
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(server_address)