Skip to content

Instantly share code, notes, and snippets.

View noahbass's full-sized avatar

Noah Bass noahbass

View GitHub Profile
@noahbass
noahbass / nodejs-tcp-example.js
Created September 18, 2018 23:49 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
import XCTest
typealias Quality = Int
typealias SellIn = Int
typealias UpdateRule = (Quality, SellIn) -> Quality
enum ItemType {
case normal
# First, run:
# virtualenv venv
# . venv/bin/activate
# pip install beautifultable
import csv
from beautifultable import BeautifulTable
# import numpy as np
# map: 6+2 -> graduation_date
@noahbass
noahbass / index.html
Last active July 26, 2016 13:10
Meteor external api example: bibles.org api
<head>
<title>meteor external api example</title>
</head>
<body>
<table>
<p>{{{verse.verse}}}</p>
<p>{{{verse.text}}}</p>
</table>
</body>
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
# Screenshot: http://i.imgur.com/s0Blh.png
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi
<?php
function main()
{
$count = 3;
$count2 = 1;
while(True) {
$isprime = True;
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
# Screenshot: http://i.imgur.com/s0Blh.png
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi
@noahbass
noahbass / binary2num.py
Created November 11, 2014 18:03
convert a binary to an integer
b = '10' # binary input
b = b[::-1]
number = 0
for i in b:
i = int(i)
if i != 0:
number += 2**i
@noahbass
noahbass / num2binary.py
Created November 11, 2014 16:28
convert an integer to a binary
i = 10
nums = []
if i == 0:
nums.append(0)
else:
while i >= 1:
if (i//2) % 2 == 0:
nums.append(1)
var index = lunr(function() {
this.field('title', {
boost: 10
})
this.field('body')
this.ref('id')
});
{% for post in site.posts %}
index.add({