This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Reads articles from a Wikipedia dump. The file currently must be BUnzipped. XML is assumed to be valid. <seealso cref="https://dumps.wikimedia.org/enwiki/"/> | |
/// </summary> | |
/// <param name="filename">An unzipped Wikipedia dump</param> | |
/// <returns>An IEnumerable of articles from the XML file</returns> | |
public static IEnumerable<WikipediaArticle> ReadArticlesFromXmlDump(string filename) | |
{ | |
var settings = new XmlReaderSettings() | |
{ | |
ValidationType = ValidationType.None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Writes a set of <see cref="WikipediaArticle"/>s to disk in a simple binary format consisting of the article title and the plaintext contents. | |
/// </summary> | |
/// <param name="articles">A set of articles, probably from <see cref="ReadArticlesFromXmlDump"/></param> | |
/// <param name="outputFilename">The filename into which articles should be saved</param> | |
/// <returns>The number of articles written</returns> | |
public static int WriteToDisk(IEnumerable<WikipediaArticle> articles, string outputFilename) | |
{ | |
var numberOfArticles = 0; | |
using (var fh = File.Create(outputFilename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command "if ((New-Object -ComObject Wscript.Shell).Popup('Remember how bloated Chrome is? Open Edge instead?',0,'Really?',0x1)) { start microsoft-edge: } else { start chrome.exe }" -WindowStyle Hidden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MicrosoftCognitiveTranslator | |
open System | |
open System.Net | |
open System.Net.Http | |
open System.Web | |
type Translator() = | |
let AsyncGetAccessToken () = | |
let CognitiveServicesAccountKey = "<your cognitive services key>" // see portal.azure.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("d3-selection"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-transition"],r):r(t.venn={},t.d3,t.d3)}(this,function(t,C,r){"use strict";var w=1e-10;function x(r,t){var n,e=function(t){for(var r=[],n=0;n<t.length;++n)for(var e=n+1;e<t.length;++e)for(var a=k(t[n],t[e]),i=0;i<a.length;++i){var s=a[i];s.parentIndex=[n,e],r.push(s)}return r}(r),a=e.filter(function(t){return function(t,r){for(var n=0;n<r.length;++n)if(R(t,r[n])>r[n].radius+w)return!1;return!0}(t,r)}),i=0,s=0,u=[];if(1<a.length){var o=P(a);for(n=0;n<a.length;++n){var f=a[n];f.angle=Math.atan2(f.x-o.x,f.y-o.y)}a.sort(function(t,r){return r.angle-t.angle});var l=a[a.length-1];for(n=0;n<a.length;++n){var h=a[n];s+=(l.x+h.x)*(h.y-l.y);for(var x={x:(h.x+l.x)/2,y:(h.y+l.y)/2},c=null,g=0;g<h.parentIndex.length;++g)if(-1<l.parentIndex.indexOf(h.parentIndex[g])){var v=r[h.parentIndex[g]],p=Math.atan2(h.x-v.x,h.y-v.y),d= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am aeshirey on github. | |
* I am adamshirey (https://keybase.io/adamshirey) on keybase. | |
* I have a public key ASBGD1ACCiGZ0YRRZCuMxEAZncMYrJI5_Ima7UdJqXYRogo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code accompanying my blog post on my kegerator setup, found here: | |
// http://www.dingostick.com/2018/12/kegerator-v10.html | |
// 1. https://www.pjrc.com/teensy/td_libs_OneWire.html | |
#include <OneWire.h> | |
// 2. https://github.com/milesburton/Arduino-Temperature-Control-Library | |
#include <DallasTemperature.h> | |
#define LOGGING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import paho.mqtt.client as mqtt | |
import json | |
import requests | |
BROKER = '192.168.0.1' | |
TOPIC = "weather/renton" | |
URL = "http://api.openweathermap.org/data/2.5/weather?id=5808189&APPID=<your api key goes here>" | |
API_DELAY_SEC = 60 * 10 # every 10 minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- id: '1234' | |
alias: ventilate_on | |
trigger: | |
- payload: 'on' | |
platform: mqtt | |
topic: ventilate | |
condition: [] | |
action: | |
- data: | |
entity_id: switch.wind_tunnel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# maximum allowable delta (°F) before we start the fans | |
TEMP_DELTA = 5.0 | |
def check_temp(): | |
global VENTILATION_STATE | |
c = db.cursor() | |
# get the last ten minutes of data only | |
c.execute("SELECT temp, room FROM temps WHERE (julianday('now') - julianday(timestamp))*86400 < 600 ORDER BY timestamp") | |
inside_temps, outside = [], 0.0 |
OlderNewer