Skip to content

Instantly share code, notes, and snippets.

[user]
email = [email protected]
name = dongy7
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
@dongy7
dongy7 / mongo-setup.md
Last active September 6, 2017 16:59
MongoDB Setup

Install MongoDB

MacOS

  1. Open terminal and run the following command to install Homebrew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Update Homebrew with the following command: brew update
  3. Install MongoDB package: brew install mongodb
  4. Create the data directory: mkdir -p /data/db
  5. Set correct permissions for the data directory: sudo chown -R `id -un` /data/db

Windows

@dongy7
dongy7 / auto-deploy.md
Created April 1, 2017 18:52 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@dongy7
dongy7 / feed.py
Created November 15, 2016 17:22
Basic OpenCV script to save video feed
#!/usr/bin/env python
import sys
import signal, os
import argparse
try:
import pip
except:
raise Exception('Pip is not installed')
from PIL import Image
from sys import argv, stderr
def imgToHexStr(img_filename, size=(16,16)):
"""Returns a hex string representing a resized image in 4:4:4 RGB."""
img = Image.open(img_filename, 'r')
img = img.resize(size, Image.NEAREST)
img = img.convert(mode='RGB')
imgdata = [(r,g,b) for (r,g,b) in list(img.getdata())]