Skip to content

Instantly share code, notes, and snippets.

View jazinheira's full-sized avatar

John Azinheira jazinheira

  • Washington, D.C.
View GitHub Profile
@jazinheira
jazinheira / zen32_zwavejs2mqtt.yaml
Last active August 23, 2022 12:16 — forked from Matt-PMCT/zen32_zwavejs2mqtt.yaml
HASS Blueprint for ZEN32 Scene Switch and zwavejs2mqtt
blueprint:
name: ZEN32 (Z-Wave JS)
description: Create automations for the Zooz ZEN32 switch using the Z-Wave JS integration.
domain: automation
input:
zooz_switch:
name: Zooz Switch
description: List of available Zooz ZEN32 switches.
selector:
device:
@jazinheira
jazinheira / foil.html
Last active May 5, 2021 20:56
RWM_foil_activity
<div class="standoutbox standoutbox-sm text-center">
<!-- Original: https://www.onemathematicalcat.org/algebra_book/online_problems/foil_1x.htm (2021) -->
<!-- Modified: 2021 John Azinheira, Saylor Academy -->
<!-- the &nbsp; are needed to give give a little space when you jump to the exercises -->
<div class="card-body">
<h4 class="card-title">Practice Questions</h4>
<br>
<p>
Answers must be written in the most conventional way:<br> $$x^{2}$$ term first, $$x$$ term next, constant term last.<br>
<br> For example, type 'x^2' for $$x^2$$.<br>
@jazinheira
jazinheira / country_migration.php
Created June 9, 2020 21:53
Country Migration Script - get the country code for all users in moodle, convert the country code to a full country name, and migrate this to a custom profile field
<?php
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
cli_heading('Migrate users\' country selection to a profile field');
function countryCodeToName($code) {
switch ($code) {
@jazinheira
jazinheira / legacy_course_list.txt
Created November 28, 2018 00:10
legacy.saylor.org course list
course_arth110
course_arth111
course_arth201
course_arth202
course_arth206
course_arth207
course_arth208
course_arth209
course_arth210
course_arth301
@jazinheira
jazinheira / rewrite.sh
Created November 28, 2018 00:09
Pull all the legacy courses listed in course_list.txt and replace old resource URLs with archival URLs
#!/bin/bash
old_url_regex="https?://www.saylor.org/site"
replace_url="https://resources.saylor.org/archived"
commit_msg="Replace legacy www.saylor.org resource URLs with archival URLs."
while read course_name; do
echo $course_name;
@jazinheira
jazinheira / gist:bbbfa384f1f4d631ec656835c334d186
Last active April 19, 2018 02:37
Disposable Email Blacklist
facebook.com qq.com 0-mail.com 027168.com 0815.ru 0815.ry 0815.su 0845.ru 0clickemail.com 0wnd.net 0wnd.org 0x207.info 1-8.biz 100likers.com 10mail.com 10mail.org 10minut.com.pl 10minutemail.cf 10minutemail.co.uk 10minutemail.co.za 10minutemail.com 10minutemail.de 10minutemail.ga 10minutemail.gq 10minutemail.ml 10minutemail.net 10minutesmail.com 10x9.com 123-m.com 12houremail.com 12minutemail.com 12minutemail.net 140unichars.com 147.cl 14n.co.uk 1ce.us 1chuan.com 1fsdfdsfsdf.tk 1mail.ml 1pad.de 1st-forms.com 1to1mail.org 1zhuan.com 20email.eu 20email.it 20mail.in 20mail.it 20minutemail.com 2120001.net 21cn.com 24hourmail.com 24hourmail.net 2fdgdfgdfgdf.tk 2prong.com 30minutemail.com 33mail.com 36ru.com 3d-painting.com 3l6.com 3mail.ga 3trtretgfrfe.tk 4-n.us 418.dk 42o.org 4gfdsgfdgfd.tk 4mail.cf 4mail.ga 4warding.com 4warding.net 4warding.org 5ghgfhfghfgh.tk 5gramos.com 5mail.cf 5mail.ga 5oz.ru 5x25.com 60minutemail.com 672643.net 675hosting.com 675hosting.net 675hosting.org 6hjgjhgkilkj.tk 6ip.us 6mail.cf 6m
bucket=your-bucket-name
contentType="text/plain"
dateValue="`date +'%a, %d %b %Y %H:%M:%S %z'`"
stringToSign="GET\n\n${contentType}\n${dateValue}\n${resource}"
s3Key=xxxxxx
s3Secret=xxxxx
signature=`/bin/echo -en "$stringToSign" | openssl sha1 -hmac ${s3Secret} -binary | base64`
file1=file-name
resource1="/${bucket}/${file1}"
@jazinheira
jazinheira / route53DynDNS.bash
Created February 29, 2016 19:22
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
### User Settings (things you must set)
## Location of the dnscurl.pl script
DNSCurl="/path/to/route53DynDNS/dnscurl.pl"
## The host name you wish to update/create
myHostName="*"
## Zone/domain in which host (will) reside(s)
myDomainName="example.com"
@jazinheira
jazinheira / convert_country2code
Created January 12, 2016 22:02
This PHP function will take a string of a country name and return the 2 letter country code found at https://www.iso.org/obp/ui/#search.
function convert_country2code($name) {
$name_lc = mb_strtolower($name, 'UTF-8');
$COUNTRIES = array (
"andorra" => "AD",
"united arab emirates" => "AE",
"uae" => "AE",
"afghanista" => "AF",
"antigua and barbuda" => "AG",
@jazinheira
jazinheira / dbself_post.md
Last active November 9, 2015 19:01
DBSelf Plugin Post

#Syncing courses from ePortfolio using the DBSelf plugin

For the last couple of months, you may have noticed that both your in-progress and completed courses - non-legacy courses, that is - are synced from ePortfolio to learn.saylor.org. Syncing that information between the two systems turned out to be a bit of a challenge. Moodle (the LMS we use for learn.saylor.org) seems to be designed with more traditional schools in mind and, sometimes, this is at odds with our use case as a provider of free, open, and self-paced courses.

Moodle comes pre-installed with an enrollment plugin ("External database") designed to connect to an external database, read the enrollments, and enroll the appropriate students in each course. We initially tested this plugin but found it not quite working for our use case of having an open instance of Moodle where students can enroll and unenroll at will; the plugin creates a new enrollment type, called 'database', and proceeds to enr