In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imaplib, email, email.parser, email.policy | |
import html2text | |
import pprint, sys | |
# | |
# Utilities for Debug | |
# | |
pp = pprint.PrettyPrinter(indent=4, width=80) | |
def myprint(str): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 生成 dhparam.pem 文件, 在命令行执行任一方法: | |
# 方法1: 很慢 | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 | |
# 方法2: 较快 | |
# 与方法1无明显区别. 2048位也足够用, 4096更强 | |
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.activestate.com/recipes/474088-tail-call-optimization-decorator/ | |
#!/usr/bin/env python2.4 | |
# This program shows off a python decorator( | |
# which implements tail call optimization. It | |
# does this by throwing an exception if it is | |
# it's own grandparent, and catching such | |
# exceptions to recall the stack. | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Internal | |
- SSH | |
- Python | |
- YAML | |
## Concepts | |
- Inventory | |
- Playbooks | |
- Roles | |
- Tasks/Handlers/Vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: jiangchengyao@gmail.com | |
[mysql] | |
prompt = [\\u@\\h][\\d]>\\_ | |
[mysqld] | |
# basic settings # | |
user = mysql | |
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER" | |
autocommit = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
while ($line = <>){ | |
if (($line !~ /BEGIN TRANSACTION/) && ($line !~ /COMMIT/) && ($line !~ /sqlite_sequence/) && ($line !~ /CREATE UNIQUE INDEX/)){ | |
if ($line =~ /CREATE TABLE \"([a-z_]*)\"(.*)/){ | |
$name = $1; | |
$sub = $2; | |
$sub =~ s/\"//g; | |
$line = "DROP TABLE IF EXISTS $name;\nCREATE TABLE IF NOT EXISTS $name$sub\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Consistent load-balancing. | |
We have a few servers and we want a load-balancer to | |
distribute incoming requests across them in a deterministic | |
and consistent way - without keeping any counter to make the | |
decision. | |
Removing a backend server should not impact users on other | |
servers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
response = urllib.urlopen('http://192.168.77.21:9001/v2/coreinfowatcher?watch=1&heartbeat=1') | |
for line in response: | |
print line |
NewerOlder