Same as QObject List Model but with a factory function and arbitrary keys.
See also
| #!/bin/python | |
| # -*- coding: utf-8 -*- | |
| # I found the interface id is not a fixed value... | |
| import subprocess | |
| INTERFACE = "tincvpn" | |
| ROUTE = "route add 10.0.0.0 mask 255.0.0.0 192.168.102.199 metric 1 if %s" | |
| def get_interface_id(): | |
| interfaces = subprocess.check_output("netsh int ipv4 show interfaces") |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| python_3_email_with_attachment.py | |
| Created by Robert Dempsey on 12/6/14. | |
| Copyright (c) 2014 Robert Dempsey. Use at your own peril. | |
| This script works with Python 3.x | |
| NOTE: replace values in ALL CAPS with your own values |
| <!-- | |
| This is a sample email taken from https://developers.google.com/gmail/schemas/apps-script-tutorial | |
| and used to test the GMail actions support. | |
| --> | |
| <html> | |
| <head> | |
| <script type="application/ld+json"> | |
| { | |
| "@context": "http://schema.org", | |
| "@type": "EmailMessage", |
Same as QObject List Model but with a factory function and arbitrary keys.
See also
| pyinstaller -F -w --noupx main.spec |
| #!/bin/bash | |
| # first login and store the cookie | |
| wget --post-data='name=USERNAME&pass=PASSWORD&op=Log%20in' --save-cookies=my-cookies.txt --keep-session-cookies "https://private.site.com" > /dev/null 2>&1 | |
| # now we can scrape the site (353 pages) | |
| for i in {0..353} | |
| do | |
| echo "grabbing page $i..." | |
| wget --cookies=on --keep-session-cookies --load-cookies=my-cookies.txt "https://private.site.com/people?page=$i" > /dev/null 2>&1 |
| # -*- coding: utf-8 -*- | |
| # Form implementation generated from reading ui file 'design.ui' | |
| # | |
| # Created: Wed May 27 16:39:17 2015 | |
| # by: PyQt4 UI code generator 4.11.3 | |
| # | |
| # WARNING! All changes made in this file will be lost! | |
| from PyQt4 import QtCore, QtGui |
| # First run: | |
| apt-get install apt-cacher python-vm-builder | |
| vi /etc/default/apt-cacher # ensure autostart is enabled | |
| sudo service apt-cacher start | |
| git clone git://github.com/bitcoin/bitcoin.git | |
| git clone git://github.com/devrandom/gitian-builder.git | |
| mkdir gitian-builder/inputs | |
| wget 'http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.5.tar.gz' -O gitian-builder/inputs/miniupnpc-1.5.tar.gz | |
| wget 'http://downloads.sourceforge.net/project/wxwindows/2.9.1/wxWidgets-2.9.1.tar.bz2' -O gitian-builder/inputs/wxWidgets-2.9.1.tar.bz2 |
| import _winreg as reg | |
| import win32file | |
| adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}' | |
| def get_device_guid(): | |
| with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters: | |
| try: |
| extern "C" int self_main(int argc, char**argv) | |
| { | |
| //char cmdline[1024]={}; | |
| std::string cmdLine; | |
| //std::getline(std::fstream("/proc/self/cmdline", std::ios::binary|std::ios::in), cmdLine); | |
| std::getline(std::fstream("/proc/self/cmdline", std::ios::in), cmdLine); | |
| std::string::size_type pos=0; | |
| std::string oldStr; |