Skip to content

Instantly share code, notes, and snippets.


Piotr Wittchen pwittchen

View GitHub Profile
pwittchen /
Created Jul 24, 2020
dummy python server
from http.server import BaseHTTPRequestHandler, HTTPServer
host="localhost" ; port=8080
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200) ; self.end_headers() ; self.wfile.write(b'ok')
print("http server is running at " + host + ":" + str(port))
HTTPServer((host, port), HTTPRequestHandler).serve_forever()
pwittchen /
Created Sep 23, 2015
Starting and stopping simple HTTP server in background on Linux. After starting server and closing terminal, server should keep running
# starting simple HTTP server with Python in background
screen -d -m python -m SimpleHTTPServer 7777
# killing process running with screen in background
kill -9 `top -n 1 | pgrep screen`
# to remote host
cat localfile.conf | ssh user@hostname 'cat -> /tmp/remotefile.conf'
# from remote host
ssh user@hostname 'cat /tmp/remotefile.conf' > /tmp/localfile.conf
pwittchen / loadJson.js
Created Apr 19, 2014
Loading JSON file with JavaScript. Please note: it won't run as a "local" script. JavaScript does not allow to load local files due to security reasons. You should deploy it on the server in order to load JSON file.
View loadJson.js
function loadJson(callback) {
var XmlHttpRequest = new XMLHttpRequest();
XmlHttpRequest.overrideMimeType("application/json");'GET', 'file.json', true);
XmlHttpRequest.onreadystatechange = function () {
if (XmlHttpRequest.readyState == 4 && XmlHttpRequest.status == "200") {
// .open will NOT return a value
// but simply returns undefined in async mode so use a callback
pwittchen / android_broadcast_intent_actions
Created Jan 29, 2015
List of all Android Broadcast Intent actions. Since API 17.
View android_broadcast_intent_actions
pwittchen /
Created Apr 24, 2018 — forked from okapies/
Ubuntu 16.04 on ThinkPad T470s

This is a document describing how to install Ubuntu 16.04 LTS on ThinkPad T470s.

My Hardware

  • CPU: Intel Core i7-7600U (2.80GHz, 4MB cache)
  • Graphics: Intel HD Graphics 620
  • Display: 14” WQHD (2560 X 1440) IPS Non-Touch Anti-Glare
  • Memory: 24GB DDR4 2133 MHz (8GB Onboard + 16GB)
  • SSD: PCIe-NVMe 256G OPAL 2.0
  • Wireless: Intel Dual Band Wireless AC (2x2) 8265 Bluetooth 4.1
  • Fingerprint Reader
View 5 minute local Kubernetes Cluster on Mac
# Reference:
# install homebrew and cask
ruby -e "$(curl -fsSL"
# install virtualbox
brew cask install virtualbox
# install dockertoolbox
pwittchen /
Created Jan 27, 2018 — forked from mackuba/
Lista coworkingów w Krakowie

Coworking w Krakowie

Studio Kreatywnej Współpracy

Adres: ul. Królewska 2/2

  • miesiąc - 420 + VAT
  • 10 dni - 230 + VAT
pwittchen /
Created Jan 12, 2018 — forked from spalladino/
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
pwittchen / Custom-Jan-2018_blue_green_orange.json
Created Jan 4, 2018
Custom Color Scheme for Tilix Terminal on Ubuntu Linux (based on Monokai Dark)
View Custom-Jan-2018_blue_green_orange.json
"background-color": "#2E3436",
"badge-color": "#FFFFFF",
"bold-color": "#FFFFFF",
"comment": "",
"cursor-background-color": "#000000",
"cursor-foreground-color": "#FFFFFF",
"foreground-color": "#BABDB6",
"highlight-background-color": "#000000",
"highlight-foreground-color": "#FFFFFF",
You can’t perform that action at this time.