Skip to content

Instantly share code, notes, and snippets.

@Lordshell
Lordshell / 1_pdf.py
Created February 18, 2019 22:35 — forked from philfreo/1_pdf.py
Three ways to make a PDF from HTML in Python (preferred is weasyprint or phantomjs)
def render_pdf_weasyprint(html):
from weasyprint import HTML
pdf = HTML(string=html.encode('utf-8'))
return pdf.write_pdf()
def render_pdf_xhtml2pdf(html):
"""mimerender helper to render a PDF from HTML using xhtml2pdf.
Usage: http://philfreo.com/blog/render-a-pdf-from-html-using-xhtml2pdf-and-mimerender-in-flask/
"""
@Lordshell
Lordshell / 1_pdf.py
Created February 18, 2019 22:35 — forked from philfreo/1_pdf.py
Three ways to make a PDF from HTML in Python (preferred is weasyprint or phantomjs)
def render_pdf_weasyprint(html):
from weasyprint import HTML
pdf = HTML(string=html.encode('utf-8'))
return pdf.write_pdf()
def render_pdf_xhtml2pdf(html):
"""mimerender helper to render a PDF from HTML using xhtml2pdf.
Usage: http://philfreo.com/blog/render-a-pdf-from-html-using-xhtml2pdf-and-mimerender-in-flask/
"""
version: "3.3"
services:
traefik:
image: traefik
command: --web --docker --docker.swarmmode --docker.watch --docker.domain=cirrus.io --logLevel=DEBUG
ports:
- "80:80"
- "8080:8080"
- "443:443"
@Lordshell
Lordshell / OutlookCalendar.py
Created August 14, 2018 13:16 — forked from jackqt/OutlookCalendar.py
Fetch calendar information of outlook from win32com API
from win32com.client import Dispatch
from tabulate import tabulate
import datetime
import pdb
OUTLOOK_FORMAT = '%m/%d/%Y %H:%M'
outlook = Dispatch("Outlook.Application")
ns = outlook.GetNamespace("MAPI")
appointments = ns.GetDefaultFolder(9).Items
@Lordshell
Lordshell / pyside.py
Created June 9, 2018 19:49 — forked from hogelog/pyside.py
QSystemTrayIcon Example
#!/usr/bin/python
# Import PySide classes
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class App:
def __init__(self):
@Lordshell
Lordshell / pyside.py
Created June 9, 2018 19:49 — forked from hogelog/pyside.py
QSystemTrayIcon Example
#!/usr/bin/python
# Import PySide classes
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class App:
def __init__(self):
git fetch --all
git reset --hard origin/master
@Lordshell
Lordshell / remote_script
Created February 17, 2018 21:17
how to use ssh to run shell script on a remote machine
ssh root@10.10.20.141 'bash -s' < /data/git/blf-export/server_101020141_check.sh
@Lordshell
Lordshell / cloudSettings
Last active March 2, 2017 08:08
Visual Studio Code Sync Settings GIST
{"lastUpload":"2017-03-02T08:08:42.012Z","extensionVersion":"v2.5.1"}
@Lordshell
Lordshell / menu.py
Created July 6, 2016 20:48 — forked from Mjiig/menu.py
Terminal menu in python
# -*- coding: utf-8 -*-
# Topmenu and the submenus are based of the example found at this location http://blog.skeltonnetworks.co…..stom-menu/
# The rest of the work was done by Matthew Bennett and he requests you keep these two mentions when you reuse the code
import curses, os #curses is the interface for capturing key presses on the menu, os launches the files
screen = curses.initscr() #initializes a new window for capturing key presses
curses.noecho()
curses.cbreak()
curses.start_color() # Lets you use colors when highlighting selected menu option
screen.keypad(1) # Capture input from keypad
# Change this to use different colors when highlighting