Skip to content

Instantly share code, notes, and snippets.

View dacoffey's full-sized avatar
😎
BLAZING FAST!! 😂

David Adam Coffey dacoffey

😎
BLAZING FAST!! 😂
View GitHub Profile
@bsatrom
bsatrom / hook_stdout.coffee
Created November 8, 2011 21:56
Samples for hooking into STDOUT for unit testing in Node.js
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 December 29, 2013 05:17
Quick-and-Dirty Image Randomizer using JavaScript and Imgur's RESTful API
<!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 January 31, 2014 22:11
Gist Markdown Cheatsheet

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


Paragraph

@jacobblock
jacobblock / FreeNAS.md
Last active October 22, 2023 13:01
Ultimate FreeNAS Setup

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

@kraftb
kraftb / I2C_Adapter.ino
Created May 19, 2015 15:31
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
@cestrand
cestrand / main.cpp
Created August 15, 2015 23:32
KDE Plasma 4 applet template for Qt Creator
#include "main.h"
#include <QPainter>
#include <plasma/theme.h>
MyPlasmaApplet::MyPlasmaApplet(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args)
{ // rather don't add other stuff here. Use init() instead
setBackgroundHints(DefaultBackground);
@anvaka
anvaka / 00.Intro.md
Last active March 7, 2024 13:07
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@gbaman
gbaman / HowToOTG.md
Last active March 29, 2024 07:11
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

@balloob
balloob / sensor_example.py
Last active November 23, 2021 16:31
Example platforms and automation component for Home Assistant
"""
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 March 26, 2024 20:52
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

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