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
@verhulstm
verhulstm / index.html
Created February 17, 2019 07:31 — forked from umidjons/index.html
Upload File using jQuery.ajax() with progress support
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload File using jQuery.ajax() with progress support</title>
</head>
<body>
<input type="file" name="file" id="sel-file"/>
apt -y update
apt -y upgrade
apt -y install build-essential
apt -y install git
apt -y install wget
apt-get --no-install-recommends -yqq install \
bash-completion \
build-essential \
cmake \
@verhulstm
verhulstm / cherrypyserver.py
Created January 1, 2019 06:42 — forked from rafaelhdr/cherrypyserver.py
Cherrypy server with Flask application
# Reason for choosing cherrypy
# https://blog.appdynamics.com/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/
#
# Flask application based on Quickstart
# http://flask.pocoo.org/docs/0.12/quickstart/
#
# CherryPy documentation for this
# http://docs.cherrypy.org/en/latest/deploy.html#wsgi-servers
# http://docs.cherrypy.org/en/latest/advanced.html#host-a-foreign-wsgi-application-in-cherrypy
# Install: pip install cherrypy
import cherrypy
cherrypy.config.update({'server.socket_host': '0.0.0.0',
'server.socket_port': 8080,
})
class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True
import socket
import re
import sys
def check_server(address, port):
# Create a TCP socket
s = socket.socket()
print "Attempting to connect to %s on port %s" % (address, port)
try:
s.settimeout(1)
from PySide import QtCore, QtGui, QtWebKit
import sys
app = QtGui.QApplication(sys.argv)
testWindow = QtGui.QMainWindow()
testWindow.show()
app.setActiveWindow(testWindow)
app.exec_()
import os, sys
import Image
im = Image.open(dir + '/' + filename)
box = (16, 123, 960-24, 720-197)
region = im.crop(box)
region.save('cropped/' + filename.lower(), "png")
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# hellowebkit.py
# Copyright 2009 Piotr Maliński, riklaunim@gmail.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#!/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
#!/usr/bin/env python3
import os
for root, directories, filenames in os.walk('/tmp/'):
for directories in directories:
print(os.path.join(root,directories))