配有英伟达显卡的主机,装完 Ubuntu 16.04 后出现闪屏现象,是由于没有安装显卡驱动。
显卡型号
NVIDIA Corporation GM204 [GeForce GTX 970]
#!/usr/bin/env python | |
"""This is a demonstration of sharing file descriptors across processes. | |
It uses Tornado (need a recent post-2.0 version from github) and the | |
multiprocessing module (from python 2.6+). To run it, start one copy | |
of fdserver.py and one or more copies of testserver.py (in different | |
terminals, or backgrounded, etc). Fetch http://localhost:8000 and | |
you'll see the requests getting answered by different processes (it's | |
normal for several requests to go to the same process under light | |
load, but under heavier load it tends to even out). |
# -*- 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 |
/* 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 */ |
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,) |
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. | |
*/ |
#!/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 |
#! /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 |
#!/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. | |
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: