Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
BLAZING FAST!! 😂

David Adam Coffey dacoffey

😎
BLAZING FAST!! 😂
View GitHub Profile
@bsatrom
bsatrom / hook_stdout.coffee
Created Nov 8, 2011
Samples for hooking into STDOUT for unit testing in Node.js
View hook_stdout.coffee
exports = module.exports
exports.setup = (callback) ->
write = process.stdout.write
process.stdout.write = ((stub) ->
(string, encoding, fd) ->
stub.apply process.stdout, arguments
callback string, encoding, fd)(process.stdout.write)
anonymous
anonymous / imgur_random.html
Created Dec 29, 2013
Quick-and-Dirty Image Randomizer using JavaScript and Imgur's RESTful API
View imgur_random.html
<!DOCTYPE html>
<html>
<body>
<script>
// I've omitted my Imgur client ID. You'll need to create and account and register your app which will give access to the API.
client_id="[omitted]"
auth_url="https://api.imgur.com/3/gallery/random/random/"
@benstr
benstr / readme.md
Created Jan 31, 2014
Gist Markdown Cheatsheet
View readme.md

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@jacobblock
jacobblock / FreeNAS.md
Last active Sep 16, 2021
Ultimate FreeNAS Setup
View FreeNAS.md

FreeNAS

I started using FreeNAS in August 2013. It is fantastic piece of software and I have been really impressed by the upgrades just in the few months I've been using it. It looks like they recently went to a plugin system as of version 9 to make installing software easier for end users. I've ran into several issues related to plugins and user + group permissions so I decided to just use the available FreeBSD port system. After fiddling for a few days (now turned into months) I believe I have created something helpful for the community and anyone interested in picking up the port system. The sandbox nature of FreeNAS's jail system is especially helpful for playing around without having any consequence on your core system.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.

ToC

@gbaman
gbaman / HowToOTG.md
Last active Oct 23, 2021
Simple guide for setting up OTG modes on the Raspberry Pi Zero
View HowToOTG.md

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

@balloob
balloob / sensor_example.py
Last active Sep 15, 2020
Example platforms and automation component for Home Assistant
View sensor_example.py
"""
Copy this file to <config_dir>/example/sensor.py
Add to your configuration.yaml:
sensor:
platform: example
"""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
@gbaman
gbaman / HowToOTGFast.md
Last active Oct 26, 2021
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!
View HowToOTGFast.md

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

View aligning-images.md

Aligning images

left alignment

This is the code you need to align images to the left:

<img align="left" width="100" height="100" src="http://www.fillmurray.com/100/100">
@hawkins
hawkins / screen.js
Created Jan 16, 2017
Node.js blessed screen - keep your output separate from your input!
View screen.js
/*
* I've used blessed to create a textbox at the bottom line in the screen.
* The rest of the screen is the 'body' where your code output will be added.
* This way, when you type input, your program won't muddle it with output.
*
* To try this code:
* - $ npm install blessed --save
* - $ node screen.js
*
* Key points here are:
@actuino
actuino / bt_speaker-raspberry_pi-zero_w.md
Last active Sep 29, 2021
Setting up a Bluetooth Speaker from the command line on a raspberry Pi Zero W
View bt_speaker-raspberry_pi-zero_w.md

The setup of a bluetooth speaker on a Pi Zero W is pretty touchy.

Please get in touch via Twitter @actuino or http://www.actuino.fr/ if you've got comments or improvements to this quick draft.

First checks

  • Use a solid power source
  • check the speaker works on another hardware (android phone f.i.)
  • make sure you've updated your Raspbian, install and run rpi-update just in case.