Skip to content

Instantly share code, notes, and snippets.

@brianglass
brianglass / example.tex
Last active May 30, 2024 02:09
Latex Commentary Example
\chapter{The Campaign of Holofernes}
\vskipnextgrid
\begin{bibleverse}
\dropcap{I}{n} the thirteenth year of the reign of
Nabuchodonosor, the two and twentieth day of the first month, the word
was given out in the house of Nabuchodonosor king of the Assyrians, that
he would revenge himself. \versenum{2} And he called all the ancients, and all the
governors, and his officers of war, and communicated to them the secret
of his counsel: \versenum{3} And he said that his thoughts were to bring all the
@brianglass
brianglass / example.php
Created February 23, 2023 18:50
PHP Orthocal Example
<?php
// Get today's information
$json = file_get_contents('https://orthocal.info/api/gregorian/');
$day = json_decode($json);
?>
<!DOCTYPE html>
<html>
<head>
<title>Daily Readings</title>
</head>
@brianglass
brianglass / antiochian.py
Last active February 15, 2023 22:34
Fetch Liturgical Information from Antiochian.org
import json
import sys
from datetime import date, datetime, timedelta
from urllib.parse import urljoin
import requests
CLIENT_ID = 'antiochian_api'
CLIENT_SECRET = 'TAxhx@9tH(l^MgQ9FWE8}T@NWUT9U)'
@brianglass
brianglass / orthocal-example.html
Last active February 28, 2023 19:32
Embed Daily Readings Example for ES6
<html>
<body>
<h1>Daily Readings</h1>
<article id="readings">
</article>
</body>
<script>
async function load_readings() {
// Use the client's date since the server is always set to Pacific Timezone
@brianglass
brianglass / proxy.py
Created July 29, 2021 17:41
Django Channels Websocket Proxy
import asyncio
import logging
import websockets
from channels.exceptions import DenyConnection
from channels.generic.websocket import AsyncWebsocketConsumer
from django.utils.functional import cached_property
logger = logging.getLogger(__name__)
@brianglass
brianglass / main.js
Last active April 27, 2018 22:51
ES6 example of how to use the orthocal.info api
// Use the client's date since the server is always set to Pacific Timezone
const today = new Date();
// JS months are zero-origin, so we have to add 1 to the month
const url = `https://orthocal.info/api/oca/${today.getFullYear()}/${today.getMonth()+1}/${today.getDate()}/`;
fetch(url)
.then(response => response.json())
.then(day => {
// Display the title of the day
@brianglass
brianglass / sample.html
Last active February 23, 2023 17:56
Example of how to use the orthocal.info api
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1 id="title"></h1>
<p id="fast"></p>
<p id="readings"></p>
@brianglass
brianglass / gist:2884627
Created June 6, 2012 20:42
postgres ramdisk
Create ramdisk:
sudo mkdir <foo>
Add to /etc/fstab:
tmpfs <foo> tmpfs size=4G,mode=1700,uid=114,gid=125 0 1
Mount the ramdisk: