Skip to content

Instantly share code, notes, and snippets.

View johnsogg's full-sized avatar

Gabe Johnson johnsogg

View GitHub Profile
@johnsogg
johnsogg / hw2_help.md
Last active February 4, 2018 03:56
Note about data science hw 2

Help with Homework 2

Homework number 2 is crazy hard. The following hints should help.

Question 1

Q1 is about generating descriptive statistics with Numpy. If you're dealing with code that looks like np.something, you're using Numpy.

Important health tip: you have to execute each of the "In [ ]" blocks in order. Otherwise you'll get messages about things not being defined and so forth.

@johnsogg
johnsogg / longjob.go
Created August 11, 2017 18:43
Demonstration of how to coordinate many long-running goroutines using channels
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"time"
)
/*
example.go
This is a golang example of how to use SendGrid for transactional
email that uses substitutions (e.g. replace "firstName" with
"Grover"). It assumes you have a SendGrid API key.
I made this because I had to move away from Mandrill by April 27, and
SendGrid is basically across the street from me so they were the first
{
"points": [
{
"ID": 11192,
"X": 29.3592739,
"Y": -54.6364822
},
{
"ID": 11193,
"X": -6.36195946,
@johnsogg
johnsogg / Expr.g4
Created March 27, 2016 17:12
ANTLR4 semantic pred (sempred) example of Python-like context-sensitivity using JavaScript target
grammar Expr;
/*
Sample input should only have three statements in it, and should parse in a millisecond or three:
(1 +
2 *
(3 / 4 - 5
+ 7)

Keybase proof

I hereby claim:

  • I am johnsogg on github.
  • I am johnsogg (https://keybase.io/johnsogg) on keybase.
  • I have a public key whose fingerprint is E5A0 CBC0 B7D7 C8AC DC64 B709 22E7 7A60 E4AF F491

To claim this, I am signing this object:

@johnsogg
johnsogg / FontPathHelper.cs
Last active October 8, 2019 01:49
Demonstration of GetPathForGlyph and CGPath in Xamarin.iOS for getting a vector representation of character glyphs. Includes quadratic and cubic Bezier functions.
using System;
using System.Collections.Generic;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreText;
namespace Mystuff
{
public class FontPathHelper
{
// find the largest product of 4 of the numbers in any direction (up,
// down, left, right, diagonal) in my output I get the file location
// "0xbfca024c" repeated
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
#include <iostream>
using namespace std;
struct node {
int value;
node* next;
};
int add_to_all(node** top_ref, int num) {
@johnsogg
johnsogg / test.py
Last active December 11, 2015 23:59
def test_remove(self):
self.tree = self.build_big_tree()
expected = [ 6, 8, 9, 10, 11, 12, 14, 20, 27, 28 ]
# ensure it starts out as intended. this should always pass
actual = []
self.private_inorder_fetch(self.tree.root_node, actual)
self.assertEqual(expected, actual, "Initial tree was malformed. Our fault, not yours")
# remove the top node, 20