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 hidden or 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
| var request = require('then-request'); | |
| var sleep = require('sleep-promise'); | |
| sleep(2000).then(function() { | |
| console.log('2 seconds later …') | |
| }); | |
| request('GET', 'https://google.com/').getBody('utf8').then(function(value) { | |
| console.log(value); | |
| // expected output: "Success!" |
This file contains hidden or 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 yaml | |
| data = { | |
| "virtualbox:": {"id": "c", "key": "d", "SSHKEYPATH": "e"}, | |
| "digitalocean:": {"id": "c", "key": "d", "SSHKEYPATH": "e"}, | |
| "ec2:": {"id": "c", "key": "d", "SSHKEYPATH": "e"}, | |
| } | |
| with open("data.yml", "w") as outfile: | |
| yaml.dump(data, outfile, default_flow_style=False) |
This file contains hidden or 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 zipfile | |
| def zipdir(path, ziph): | |
| for root, dirs, files in os.walk(path): | |
| for file in files: | |
| ziph.write(os.path.join(root, file)) | |
| zipf = zipfile.ZipFile("dir.zip", "w", zipfile.ZIP_DEFLATED) | |
| zipdir("artifact-builder-server", zipf) | |
| zipf.close() |
This file contains hidden or 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
| # See: https://en.wikipedia.org/wiki/RSA_(cryptosystem) | |
| def factorize(n): | |
| primfac = [] | |
| d = 2 | |
| while d * d <= n: | |
| while (n % d) == 0: | |
| primfac.append(d) | |
| n //= d | |
| d += 1 |
This file contains hidden or 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
| # install miniconda env | |
| # conda create -n pyside27 python=2.7 | |
| # conda install -c anaconda pyside | |
| import sys | |
| from PySide.QtCore import * | |
| from PySide.QtGui import * | |
| from PySide.QtWebKit import * | |
| app = QApplication(sys.argv) |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script> | |
| document.addEventListener("DOMContentLoaded", function(event) { | |
| alert('hello'); | |
| }); | |
| </script> | |
| </head> | |
| <body> |
This file contains hidden or 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/env python3 | |
| import os | |
| for root, directories, filenames in os.walk('/tmp/'): | |
| for filename in filenames: | |
| print(os.path.join(root,filename)) |
This file contains hidden or 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/env python3 | |
| import os | |
| for root, directories, filenames in os.walk('/tmp/'): | |
| for directories in directories: | |
| print(os.path.join(root,directories)) |
This file contains hidden or 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/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # This file is part of the PySide project. | |
| # | |
| # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | |
| # | |
| # Contact: PySide team <contact@pyside.org> | |
| # | |
| # This program is free software; you can redistribute it and/or |
OlderNewer