Skip to content

Instantly share code, notes, and snippets.

@gbaman
gbaman / HowToOTG.md
Last active May 16, 2024 20:10
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

@kylemcdonald
kylemcdonald / CameraImage.cpp
Created November 23, 2015 15:30
openFrameworks app for sending images to disk for processing, and reading text back from disk. Used for "NeuralTalk and Walk".
#include "ofMain.h"
#include "ofxTiming.h"
class ofApp : public ofBaseApp {
public:
ofVideoGrabber grabber;
DelayTimer delay;
ofTrueTypeFont font;
string description;
(ns om-tutorial.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]))
(enable-console-print!)
(def init-data
{:dashboard/items
[{:id 0
@huytd
huytd / d3_realtime_linechart.html
Created November 6, 2015 01:11
Realtime Line Chart with D3
<style>
.axis {
font-family: sans-serif;
fill: #d35400;
font-size: 12px;
}
.line {
fill: none;
@dark4eg
dark4eg / sample
Last active November 9, 2015 14:10
{:v "27-10-2015"
:types {:added [{:promo {:id 1 :v 120}}
{:promo {:id 2 :v 20}}
{:promo {:id 4 :v 10}}]
:viewed [{:promo {:id 1 :v 110}}
{:promo {:id 2 :v 15}}
{:promo {:id 4 :v 5}}]
:yes [{:promo {:id 1 :v 100}}
{:promo {:id 2 :v 20}}
@beshkenadze
beshkenadze / react_tz.md
Last active December 21, 2023 18:22
Тестовое задание для ReactJS Frontend-разработчика

##Погодное одностраничное веб-приложение

(!) Данные можно взять с сайта openweathermap.org или с любого другого сервиса.

(!) Обязательно использовать react.js и redux.

Приложение должно уметь:

  • Добавлять/удалять города
  • Сохранять локально данные
@chroth7
chroth7 / reactD3rescources.md
Last active December 6, 2017 05:37
React/D3 Resources

React <-> D3 Resources

Thanks for all the stars.

Due to unexpected demand, I move this to a proper github repo, see here: https://github.com/chroth7/reactD3resources

I would very much like to get your PRs there, thank you!

@sgrove
sgrove / learn_gamma.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL Lesson 1" with "Learn Gamma Lesson 1"
;; Gamma (shader-generation): https://github.com/kovasb/gamma
;; Gamma Driver (WebGL resource management, aka "Om for WebGL"): https://github.com/kovasb/gamma-driver
;; Gamma examples: https://github.com/kovasb/gamma-examples
(ns gampg.learn-gamma.lesson-01
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
@chestozo
chestozo / touch-scroll-minix.jsx
Last active October 7, 2023 13:51
react.js mixin for inertial scroll (momentum scroll) on touch devices
/**
On touch devices we have an intertial scroll effect (also called momentum scroll)
that is hard to detect (with scrollTop property for example).
See this article for problem details http://andyshora.com/mobile-scroll-event-problems.html
Still it is possible to detect inertial scroll by calculating velocity
with which user is scrolling element.
In this gist we use velocity formula from this article:
http://ariya.ofilabs.com/2013/11/javascript-kinetic-scrolling-part-2.html
(defprotocol Camera)
(defn ^array perspective-camera
[^number fov ^number aspect ^number near ^number far]
(specify! (mat4/makePerspective (math/mat4) fov aspect near far)
Camera))
(defn ^array orthographic-camera
[^number left ^number right
^number bottom ^number top