Skip to content

Instantly share code, notes, and snippets.

View mjradwin's full-sized avatar

Michael J. Radwin mjradwin

View GitHub Profile
<div id="city">
<input type="text" class="typeahead" placeholder="Search for city">
</div>
@mjradwin
mjradwin / hebcal-converter-api.json
Created February 18, 2015 06:28
Hebcal Hebrew Date Converter REST API
{
"gy": 2011,
"gm": 6,
"gd": 2,
"hy": 5771,
"hm": "Iyyar",
"hd": 29,
"hebrew": "כ״ט בְּאִיָיר תשע״א",
"events": [
"Parashat Nasso",
@mjradwin
mjradwin / hebcal-legacy-1-head.html
Created February 18, 2015 06:32
Hebcal legacy JS event calendar (deprecated)
<script type="text/javascript" charset="utf-8"
src="http://www.hebcal.com/hebcal/?v=1&amp;cfg=e2&amp;nh=on&amp;nx=on&amp;year=now&amp;month=x&amp;ss=on&amp;mf=on">
</script>
<script type="text/javascript"
src="http://www.hebcal.com/i/calendar-2.0-min.js">
</script>
<link type="text/css" rel="stylesheet"
href="http://www.hebcal.com/i/jec-grey-min.css">
<style type="text/css">
#myCalendarContainer table { width: 800px }
@mjradwin
mjradwin / winsorize-apache-spark.scala
Last active August 29, 2015 14:24
Winsorize an RDD of Doubles for Apache Spark
import org.apache.spark.rdd.RDD
def winsorize(data: RDD[Double], limits:(Double,Double)): RDD[Double] = {
val r = data.sortBy(x => x)
val c = r.count()
if (c <= 2) r
else {
val n0 = limits._1 * (c + 1d)
val n1 = limits._2 * (c + 1d)
val k0 = n0.toLong
@mjradwin
mjradwin / hebcal-shabbat-style.css
Last active October 25, 2015 20:59
Hebcal example of how to style Shabbat Times
.hebcal-container {
font-family: "Gill Sans MT","Gill Sans",GillSans,Arial,Helvetica,sans-serif;
font-size: small;
}
.hebcal-container h3 {
font-family: Georgia,Palatino,"Times New Roman",Times,serif;
}
ul.hebcal-results { list-style-type:none }
ul.hebcal-results li {
margin-bottom: 11px;
# Example YAML to get you started quickly.
# Be aware that YAML has indentation based scoping.
# Code completion support is available so start typing for available options.
swagger: '2.0'
# This is your document metadata
info:
version: "1.0.0"
title: Hebcal API
description: Jewish Calendar, Hebrew Date Converter, Holidays
@mjradwin
mjradwin / calibre-news-email.sh
Created December 5, 2016 04:47
calibre-news-email.sh
#!/bin/sh
RECIPE="$1"
OUTFILE=`mktemp /tmp/news.XXXXXXXXXX.mobi`
ADDRESS="example_1234567@kindle.com"
# uses heirloom-mailx on Ubuntu which supports -a for attachments
/opt/calibre/ebook-convert \
"$RECIPE.recipe" $OUTFILE --output-profile kindle && \
#cloud-config
package_upgrade: true
packages:
- strongswan
- strongswan-plugin-eap-mschapv2
- moreutils
- iptables-persistent
- unattended-upgrades
@mjradwin
mjradwin / hebdate-en.html
Last active January 14, 2020 04:09
Displaying today's Hebrew date on your website
<script type="text/javascript" charset="utf-8"
src="https://www.hebcal.com/etc/hdate-en.js"></script>
@mjradwin
mjradwin / hebcal-shabbat-api.json
Last active July 24, 2020 18:45
Hebcal Shabbat REST API
{
"title":"São Paulo, Brazil",
"date":"2015-02-20T19:37:54-00:00",
"link":"https://www.hebcal.com/shabbat?geonameid=3448439;m=50;c=on;maj=on;nx=on;geo=geoname",
"location":{
"city":"São Paulo",
"longitude":-46.63611,
"title":"São Paulo, Brazil",
"geonameid":3448439,
"tzid":"America/Sao_Paulo",