Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Ostgard noonat

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@noonat
noonat / gevent_thread_wait.py
Created Feb 23, 2017
Spawn a thread and make the greenlet wait for it to exit.
View gevent_thread_wait.py
from __future__ import print_function
import time
import gevent
from gevent import hub, _threading
def ticker():
while True:
View gevent_threads.py
"""This is an example of cooperating between a gevent hub and normal threads."""
import gevent
import socket as _socket
from gevent import hub, socket, _threading
conns = _threading.Queue()
View kafka_consumer.go
package main
import (
"flag"
"log"
"os"
"os/signal"
"strings"
"github.com/Shopify/sarama"
View grid-step.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style type="text/css">
body {
margin: 0;
padding: 0;
}
canvas {
View cube.go
package main
import (
"fmt"
"math"
"github.com/go-gl/mathgl/mgl32"
"github.com/gopherjs/gopherjs/js"
"github.com/gopherjs/webgl"
)
@noonat
noonat / webrtc-data-channels.js
Last active Apr 17, 2020
WebRTC Data Channels
View webrtc-data-channels.js
// This is a bare bones example of creating a data channel between two WebRTC
// peers. Let's imagine two peers trying to connect to each other. We'll call
// one the "offer peer", and the other the "answer peer". The offer peer will
// be the one initiating a connection, and the answer peer will be the one
// responding to it.
//
// The two peers must use a separate connection to negotiate their connection.
// A websocket connection to a shared server is often used for this negotiation.
// They will exchange offers and answers using the websocket. Each peer will
// also attempt to discover more details about themselves (ICE), such as their
@noonat
noonat / coreos-virtualbox.md
Last active Sep 22, 2020
Installing CoreOS on VirtualBox
View coreos-virtualbox.md
  • Download and install VirtualBox.
  • Download the CoreOS ISO
  • Create a new VM in VirtualBox
    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM
    • Right click on the VM and click settings
    • Go to the storage tab
View keybase.md

Keybase proof

I hereby claim:

  • I am noonat on github.
  • I am noonat (https://keybase.io/noonat) on keybase.
  • I have a public key whose fingerprint is 280C D0D7 B06E ACF3 FD86 058A 0905 62AD 94AC 5A83

To claim this, I am signing this object:

View ruby-accessors.mkdn

Understanding Accessor Methods in Ruby

Accessing properties of an object in Ruby are a bit different than they are in JavaScript. In JavaScript, if you defined an object constructor like so:

function Foo() {
  this.x = 1;
  this.y = 2;
}
You can’t perform that action at this time.