Skip to content

Instantly share code, notes, and snippets.

View verhulstm's full-sized avatar
🏠
Working from home

Michael Verhulst verhulstm

🏠
Working from home
View GitHub Profile
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!"
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)
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()
@verhulstm
verhulstm / Install NVIDIA Driver and CUDA.md
Created June 30, 2018 07:33 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
# 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
# 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)
<!DOCTYPE html>
<html>
<head>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
alert('hello');
});
</script>
</head>
<body>
#!/usr/bin/env python3
import os
for root, directories, filenames in os.walk('/tmp/'):
for filename in filenames:
print(os.path.join(root,filename))
#!/usr/bin/env python3
import os
for root, directories, filenames in os.walk('/tmp/'):
for directories in directories:
print(os.path.join(root,directories))
#!/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