Skip to content

Instantly share code, notes, and snippets.

View deeplook's full-sized avatar

deeplook

View GitHub Profile
#!/usr/bin/env python
"""
An updated example file actually using an auto-upgrading tool.
WARNING:
If you find this script inside a GitHub gist, be warned that
its gist ID might change without notice! In this case please
look for similar filenames until this might become part of
@deeplook
deeplook / autofib-screencast.json
Created October 13, 2017 13:36
A simple module to allow Python scripts to upgrade themselves. (WIP)
{
"version": 1,
"width": 109,
"height": 25,
"duration": 80.986919,
"command": null,
"title": null,
"env": {
"TERM": "xterm-256color",
"SHELL": "/bin/bash"
@deeplook
deeplook / dynamic_cpu_load.py
Created November 3, 2017 22:56
Prototype of a 'dynamic' prompt showing CPU load over 10 seconds as a sparkline.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Prototype of a 'dynamic' prompt showing CPU load over 10 seconds as a sparkline.
Requires ``psutil``...
Not finished...
"""
@deeplook
deeplook / webpage_screenshot.py
Created November 7, 2017 13:27
Snippet for making a screenshot of a webpage in a browser.
import re
from selenium import webdriver # pip install selenium
from PIL import Image # pip install Pillow
driver = webdriver.PhantomJS() # assuming PhantomJS
width, height = 1024, 768
driver.set_window_size(width, height)
driver.get("http://docs.python-requests.org")
fn = "screenshot.png"
driver.save_screenshot(fn)
@deeplook
deeplook / browse_api.py
Last active December 22, 2017 22:31
Explore a RESTful Swagger/OpenAPI specification (JSON file) with Swagger-UI in a browser.
#!/usr/bin/env python
"""
Explore a RESTful Swagger/OpenAPI specification with Swagger-UI in a browser.
Features:
- download a recent Swagger-UI release
- extract its "dist" folder
- copy desired JSON file into "dist" folder

Keybase proof

I hereby claim:

  • I am deeplook on github.
  • I am deeplook (https://keybase.io/deeplook) on keybase.
  • I have a public key ASCT1pchPpFRS-VM4Uie8Y4fvJr3xTl9wZgqNmJ4pK469Ao

To claim this, I am signing this object:

@deeplook
deeplook / test_capturer.py
Created March 12, 2018 22:45
Testing capturer to output ANSI escape sequences over subprocesses.
#!/usr/bin/env python
"""
Testing capturer to output ANSI escape sequences over subprocesses.
"""
import subprocess
from capturer import CaptureOutput
@deeplook
deeplook / software_activities.txt
Created March 19, 2018 09:35
Things you can do when working on software, avoiding direct antonyms like 'uninstall' for 'install' (but not 'sell' for 'buy'), and modifications like 'reconfigure' for 'configure', etc.
access activate analyze approve architect archive audit
backup benchmark bugtrack build bundle buy
comment communicate compare commit comment compile compress configure connect consult containerize contribute convert
debug deploy deprecate design develop disassemble distribute document
embed encrypt evaluate execute extend
find fix formalize fork format
generate
install integrate internationalize invest
label learn license like localize log
manage merge migrate mock model monitor
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@deeplook
deeplook / bridge_days.ipynb
Created May 12, 2018 21:07
List bridge days for one year and country
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.