Skip to content

Instantly share code, notes, and snippets.

View trungdq88's full-sized avatar

Tony Dinh trungdq88

View GitHub Profile
@trungdq88
trungdq88 / elem2dict.py
Last active December 2, 2015 03:00 — forked from jacobian/elem2dict.py
Convert an lxml.etree node tree into an object.
def elem2dict(node):
"""
Convert an lxml.etree node tree into an object.
Notice: Since the xml and object (json) structure is not the same,
this utils will not work correctly if there is an xml element that
contains multiple duplicate child elements. For example:
<root>
<name>Hello</name>
<name>Is it me</name>
<hello>You looking for</hello>
@trungdq88
trungdq88 / install-comodo-ssl-cert-for-nginx.rst
Created February 21, 2017 09:28 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@trungdq88
trungdq88 / postgres-brew.md
Created February 5, 2018 01:59 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@trungdq88
trungdq88 / redis-autostart-osx.md
Created February 5, 2018 02:02 — forked from subfuzion/redis-autostart-osx.md
redis auto start OS X

Install with Homebrew

brew install redis

Set up launchctl to auto start redis

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

/usr/local/opt/redis/ is a symlink to /usr/local/Cellar/redis/x.y.z (e.g., 2.8.7)

@trungdq88
trungdq88 / routes.rake
Created February 5, 2018 02:37 — forked from oivoodoo/routes.rake
rake task for printing grape routes.
namespace :grape do
desc 'Print compiled grape routes'
task :routes => :environment do
API.routes.each do |route|
puts route
end
end
end
@trungdq88
trungdq88 / install_jupyterlab_launch_agent.sh
Last active April 19, 2019 02:43 — forked from nathanielobrown/install_jupyterlab_launch_agent.sh
script to install a jupyter lab launch agent on MacOS
cat <<EOF > ~/Library/LaunchAgents/com.$(whoami).jupyterlab.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.$(whoami).jupyterlab</string>
<key>ProgramArguments</key>