Skip to content

Instantly share code, notes, and snippets.

View andrewstellman's full-sized avatar

Andrew Stellman andrewstellman

View GitHub Profile
@andrewstellman
andrewstellman / gist:592f2050f80931833c4a901b79bad7dc
Created September 4, 2021 15:40
Weight randomized evergreen tweets by time since last sent in C#
using System;
using System.Linq;
namespace WeightByTime
{
record Tweet(long id, long time);
static class UnixTime
{
public static long EpochTime(this DateTime dateTime) =>
Serves 4-6
3/4 lb. (350g) good-quality penne (the cooking time of my penne lists an 8-9 minute cooking time)
2 or 3 shallots, finely sliced, or half of a small yellow onion, finely diced
2-4 slices of pancetta, chopped
1 bunch asparagus
1/4 lb. (115g) Feta cheese
Zest of one lemon
4 cups (960ml) Chicken stock
Kosher salt and freshly-ground pepper
@andrewstellman
andrewstellman / PoorMansLog.cs
Created November 27, 2020 14:17
PoorMansLog (taking a joke tweet way to seriously)
// https://twitter.com/AndrewStellman/status/1332042223987388420
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace LogTest
{
public class PoorMansLog : ILogger, IDisposable
{
@andrewstellman
andrewstellman / OSX-Convert-MOV-GIF.md
Created September 5, 2020 13:19 — forked from tskaggs/OSX-Convert-MOV-GIF.md
Creating GIFs from .MOV files in OSX using FFmpeg and ImageMagick

Convert MOV to GIF using FFmpeg and ImageMagick

I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!

Preparation

Install FFmpeg

  • $ brew install ffmpeg [all your options]
    • Example: $ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

Install ImageMagick

@andrewstellman
andrewstellman / README.md
Last active June 11, 2019 15:21
Quick RDF example of an ontology, data, and queries

Quick RDF example

Quick example of RDF that shows structured data. Example of triples using this ontology:

  :WallyWorld a :Company ;
    rdfs:label "Wally World Amusements" .

  :Bill a :Employee ;
 :employedBy :WallyWorld ;
@andrewstellman
andrewstellman / Option.cs
Last active March 20, 2022 23:01
Example of a toy Option<T> class
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Toy_Option
{
public abstract class Option<T> : IEnumerable<T>
{
@andrewstellman
andrewstellman / Analysis.md
Last active April 15, 2019 12:07
3-point shot percentage after other team makes or misses (NBA 2017-2018 season)

Analysis: 3-point shot percentage after other team makes or misses

This analysis shows how pbprdf was used to analyze NBA players' 3-point shot percentage after a player on the other team either made or missed a shot over the 2017-2018 regular season.

Overview

We're interested in finding 3-point shots that were made immediately after a 3-point shot taken by the other team. The way we do this is by running a SPARQL query that calculates each player's season 3-point shot percentage, the 3P% after a player on the other team misses, and the 3P% after a player on the other team makes. We want to calculate the percentage of 3-point shots that they make or miss when we include only shots that they took immediately after a player on the other team took a 3-pointer (within two lines on the play-by-play).

Here's the data that we're using to do this analysis. Each play has a set of triples that inc