Skip to content

Instantly share code, notes, and snippets.

View huangy10's full-sized avatar

Woody Huang huangy10

View GitHub Profile
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 31, 2024 13:56
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@danisfermi
danisfermi / setupdb.md
Created December 15, 2017 23:00
Setup gdb on Mac OS Sierra/High Sierra

Here are the steps to installing and setting up GDB on Mac OS Sierra/High Sierra. Run brew install gdb. On starting gdb, you will get the following error:

Unable to find Mach task port for process-id 2133: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

To fix this error, follow the following steps:

@Mahedi-61
Mahedi-61 / installing_opencv_from_source_in_Ubuntu_1804.sh
Last active April 4, 2024 05:05
Installing OpenCV from source on Ubuntu 18.04 machine
#!/bin/bash
# This gist is a step by step instructions to build and install OpenCV from source on ubuntu 18.04 LTS
# note: The easy and quick way to install is
# sudo pip3 install opencv-python
# sudo pip3 install opencv-contrib-python
# But this easy pypi installation can’t open video files on GNU/Linux distribution or on mac OS X system.
# And on some system opencv binaries provided packages are not compiled.
# Therefor we have no way rather than build it from source.
@wavezhang
wavezhang / sqlite2mysql.pl
Last active September 3, 2018 16:01
scripts to change sqlite3 db into mysql format
#! /usr/bin/perl
#
# based on https://stackoverflow.com/a/87531/5742651
# usage: sqlite3 .dump database_name.sqlite3 | perl sqlite2mysql.pl | mysql -u root -p $import_database_name
#
# ignore follow lines:
# BEGIN TRANSACTION
# COMMIT
# sqlite_sequence
# CREATE UNIQUE INDEX
@terrydang
terrydang / install_nvidia_driver_in_ubuntu1604.md
Last active August 8, 2022 09:31
Ubuntu 16.04 安装英伟达(Nvidia)显卡驱动

Ubuntu 16.04 安装英伟达(Nvidia)显卡驱动

配有英伟达显卡的主机,装完 Ubuntu 16.04 后出现闪屏现象,是由于没有安装显卡驱动。

显卡型号
NVIDIA Corporation GM204 [GeForce GTX 970]

@alex8224
alex8224 / streamuploader.py
Last active May 5, 2019 06:48
A multipart form parse for tornado
#!/usr/bin/env python
#-*-coding:utf-8 -*-
#
#Author: alex alex8224 at gmail.com
#Create by:2015-08-11 15:50:21
#Last modified:2015-10-10 09:19:05
#Filename:server.py
#Description:
from __future__ import absolute_import
import re
@natecook1000
natecook1000 / NSTimer+Closure.swift
Last active July 12, 2024 05:11
Scheduled NSTimer with a Swift closure
extension NSTimer {
/**
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
*/
@simplyvikram
simplyvikram / tornado_long_blocking.py
Last active February 27, 2022 00:07
trying to call a long blocking function in tornado in a non blocking way, updated based on feedback(https://gist.github.com/badlydrawnrod/7003909)
import tornado.web
import tornado.gen
import time
from functools import partial
import os
from concurrent.futures import ThreadPoolExecutor
def long_blocking_function(index, sleep_time):
print "Entering run counter:%s" % (index,)
@chuckreynolds
chuckreynolds / wordpress-change-domain-migration.sql
Last active February 10, 2023 18:56
UPDATE: Use WP-CLI find-replace command to edit URLs in your database. https://developer.wordpress.org/cli/commands/search-replace/ Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: al…
/* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
@glenfant
glenfant / logging_yaml_config.py
Last active November 11, 2021 14:08
A example of logging medium complex configuration using YAML on Python 2.7 or 3.2
# -*- coding: utf-8
"""\
A simple demo of logging configuration with YAML (Python 2.7)
=============================================================
Requires PyYAML -> "easy_install PyYAML"
See the recipes for configuring logging with dicts and YAML
- http://docs.python.org/2.7/howto/logging-cookbook.html
- http://stackoverflow.com/questions/10519392/python2-7-logging-configuration-with-yaml