Skip to content

Instantly share code, notes, and snippets.

dannyid /
Created Mar 27, 2017 — forked from gbaman/
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 -

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 is

dannyid /
Created Feb 10, 2017 — forked from DavideMontersino/
How to fork to a private gitlab instance


your git repository can have more than one remote server; In this case we want to have two:

  1. one for our private repository on gitlab (will be the default one, called origin)
  2. one to be connected to the source repo on github, to be able to pull new changes (will be called upstream)

How to make a private fork from github to gitlab

dannyid /
Created Nov 21, 2016
Fix Docker reboot IP/cert mismatch problem
docker-machine regenerate-certs
dannyid /
Created Nov 21, 2016
How to disable Notification Center on macOS
# Disabling Notification Center
# “process not found” error shouldn't matter
launchctl unload -w /System/Library/LaunchAgents/
killall NotificationCenter
# Enabling Notification Center
launchctl load -w /System/Library/LaunchAgents/
dannyid / javascript-puzzle.js
Last active Nov 28, 2016
Javascript puzzle.
View javascript-puzzle.js
// Given:
var i = '1';
// 1. What is the value of the below expression?
// 2. What is the value of `i` afterwards?
++i + +i+++i+i +++i+i+i+++i++ +i+++i;
dannyid /
Last active Sep 14, 2016
Download the video you're currently watching on

###What does it do?

Downloads the HD version of the Team Treehouse video you're currently watching.

###How to use:

  1. Right click on your bookmarks bar and choose Add Page...
  2. Give it a name and paste the below code in the URL section

Updating Deep Immutable Object

let newVersion = {
  language: 'Default Language', // Set default for unspecified properties
  name: 'New Name', // Override the name property
  address: {
    zipCode: '99999' // Update nested zip code
dannyid / calculateColorContrast.js
Last active Oct 8, 2015
Find the best contrast color to overlay onto given color.
View calculateColorContrast.js
export function getContrastYIQ(color, colorType){
let r, g, b;
const start = color.indexOf('#') === 0 ? 1 : 0;
if (colorType === 'hex') {
r = parseInt(color.substr(start, 2), 16);
g = parseInt(color.substr(start + 2, 2), 16);
b = parseInt(color.substr(start + 4, 2), 16);
} else if (colorType == 'rgb') {
[r, g, b] = color.slice(4, -1).split(',').map(str => +str);
dannyid / copyToClipboard.js
Created Sep 25, 2015
For use in a Chrome extension. Don't forget to enable the "clipboardWrite" permission.
View copyToClipboard.js
function copyToClipboard(text) {
const input = document.createElement('input'); = 'fixed'; = 0;
input.value = text;
dannyid / googleSearchUrl.js
Last active May 30, 2017
What do these parameters even mean?
View googleSearchUrl.js
const language = `en`,
numResults = `100`, // 1 to 100
personalization = `0`, // Non-personalized
encoding = `UTF-8`,
verbatim = `li:1`, // No auto-correct and no location
ssl = `ssl`;
const googleSearchUrl = `` +
`?q=${keyword}` +
`&hl=${language}` +