Skip to content

Instantly share code, notes, and snippets.

View terbo's full-sized avatar
💭
everybody must get annointed

CB terbo

💭
everybody must get annointed
View GitHub Profile
@mbostock
mbostock / .block
Created February 26, 2016 22:06
Transform Transitions II
license: gpl-3.0
@dotob
dotob / d3-server.coffee
Created January 6, 2016 14:12
Directly render and serve d3 visualizations from a nodejs server.
# Start `coffee d3-server.coffee`
# Then visit http://localhost:1337/
# originally from: https://gist.github.com/Caged/6407459
d3 = require('d3')
http = require('http')
jsdom = require('jsdom')
http.createServer((req, res) ->
# Chrome automatically sends a requests for favicons
# Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
@gbaman
gbaman / HowToOTG.md
Last active May 9, 2025 20:48
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@joegle
joegle / word-service.py
Created December 23, 2015 00:32
Flask + gensim word2vec
from gensim.models import word2vec
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
model1 = word2vec.Word2Vec.load_word2vec_format('models/glove_model.txt', binary=False)
model1.init_sims(replace=True)
from flask import Flask, jsonify, request
app = Flask(__name__)
def main(username, password, limit=None):
"""redditsaver
Usage: in a cmd/terminal, type python3 or py -3 depending on your OS
in the folder that you want stuff to be saved into, and place this file there too.
you must install praw beforehand (pip3 install praw)
then type "import redditsaver" without qoutes.
then type "redditsaver.main('your username', 'yourpass')" without the double qoutes
then wait, and you are done.
"""
@a-paxton
a-paxton / text-cleaning+word2vec-gensim.py
Created September 11, 2015 23:31
Cleaning Text Data and Creating 'word2vec' Model with Gensim
# preliminaries
from pymongo import MongoClient
from nltk.corpus import stopwords
from string import ascii_lowercase
import pandas as pd
import gensim, os, re, pymongo, itertools, nltk, snowballstemmer
# set the location where we'll save our model
savefolder = '/data'
@mbostock
mbostock / .block
Last active November 21, 2016 03:40
Colorcomb II
license: gpl-3.0
@mbostock
mbostock / .block
Last active November 21, 2016 03:40
Colorcomb
license: gpl-3.0
@mbostock
mbostock / .block
Last active January 23, 2020 06:55
This Is Not a Globe
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/fake-globes
@mbostock
mbostock / .block
Last active September 19, 2024 23:09
Line Drawing
license: gpl-3.0
redirect: https://observablehq.com/@d3/draw-me