Skip to content

Instantly share code, notes, and snippets.

@bcchenbc
bcchenbc / gist:a871a343c5c4f1efb1a3
Created December 30, 2015 06:12 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@bcchenbc
bcchenbc / run-multiple-redis-instances.md
Created August 27, 2016 06:32 — forked from jarvys/run-multiple-redis-instances.md
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...
@bcchenbc
bcchenbc / mturk_boto_intro.py
Created November 20, 2017 20:18 — forked from ktuite/mturk_boto_intro.py
Super simple python script that uses boto to connect to amazon mturk. If you use the sandbox, you'll see a balance of $10,000! Otherwise, you'll see your normal balance.
import boto.mturk.connection
sandbox_host = 'mechanicalturk.sandbox.amazonaws.com'
real_host = 'mechanicalturk.amazonaws.com'
mturk = boto.mturk.connection.MTurkConnection(
aws_access_key_id = 'XXX',
aws_secret_access_key = 'XXX',
host = sandbox_host,
debug = 1 # debug = 2 prints out all requests. but we'll just keep it at 1
@bcchenbc
bcchenbc / control-light-with-zen32.yaml
Last active August 11, 2022 16:22 — forked from halomakes/control-light-with-zen32.yml
Blueprint: Control a light with a button on a Zooz ZEN32 Scene Controller
blueprint:
name: Control Light with Scene Controller
description: For Zooz ZEN32. Toggle a light with a single press, set it to max brightness with double-tap, night-light mode with hold.
domain: automation
input:
zooz_switch:
name: Zooz Switch
description: List of available Zooz ZEN32 switches.
selector:
device:
@bcchenbc
bcchenbc / set-zen32-indicator-for-light.yaml
Last active August 11, 2022 16:28 — forked from halomakes/set-zen32-indicator-for-light.yml
Blueprint: Set Indicator on a ZEN32 Scene Controller button Based on Light Status
blueprint:
name: Set Indicator Light on Scene Controller
description: For Zooz ZEN32. Sets the indicator color when light is off or dimmed.
domain: automation
input:
zooz_switch:
name: Zooz Switch
description: List of available Zooz ZEN32 switches.
selector:
device: