Skip to content

Instantly share code, notes, and snippets.

View dinglixiang's full-sized avatar

Lixiang Ding dinglixiang

View GitHub Profile
@dinglixiang
dinglixiang / jsonrepair.py
Created April 7, 2024 03:46 — forked from adonig/jsonrepair.py
Repair invalid JSON documents in Python
# jsonrepair.py - Repair invalid JSON documents in Python
#
# Just https://github.com/josdejong/jsonrepair ported from TypeScript to Python.
#
# This port won't get updates, because the goal should be to generate this library instead.
#
# See: https://github.com/josdejong/jsonrepair/issues/84
#
import json
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
@dinglixiang
dinglixiang / Install_tmux
Created June 22, 2016 03:28 — forked from simme/Install_tmux
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
#!/usr/bin/env ruby
# Install gems:
# gem install github_api
# gem install hub
#
# Then run script in github repo
require 'github_api'
g = Github.new
# STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM
ps ax | grep postgres
# STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM
sudo apt-get update
sudo apt-get install postgresql-9.1
# List All Postgres related packages
dpkg -l | grep postgres

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key