This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QApplication> | |
#include <QQmlApplicationEngine> | |
#include <QMessageBox> | |
#include <QAction> | |
#include <QMenu> | |
#include <QSystemTrayIcon> | |
int init_trayicon_app() | |
{ | |
if (!QSystemTrayIcon::isSystemTrayAvailable()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
import os, re | |
ld_list_file = 'ldconfig.list' | |
pattern = re.compile(r'.*=>\s*(?P<libfile>.*)\s*') | |
lib_files = map(lambda x: x.groupdict()['libfile'], | |
filter(lambda x: x, | |
map(lambda ln: pattern.match(ln), | |
file(ld_list_file, 'r')))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button { | |
id: button1 | |
width: 230 | |
height: 179 | |
text: 'drag file to me' | |
DropArea { | |
id: fileDropArea | |
anchors.fill: parent | |
onEntered: { | |
drag.accept (Qt.CopyAction); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input_round = lambda: range(int(raw_input('\n'))) | |
input_size = lambda: range(int(raw_input('\n'))+1) | |
input_coord = lambda round, count: round if count == 0 else raw_input('').split(' ') | |
print [input_coord(round, count) for round in input_round() for count in input_size()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# coding: utf-8 | |
import sys | |
import ctypes | |
def run_as_admin(argv=None, debug=False): | |
shell32 = ctypes.windll.shell32 | |
if argv is None and shell32.IsUserAnAdmin(): | |
return True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# coding: utf-8 | |
# -------------------------------------------- | |
# Make data for test. | |
with file('g:\\data.txt', 'w') as fd: | |
for i in range(1000): | |
fd.write('%d\n' % i) | |
fd.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STATE_OPEREND = 0 | |
STATE_OPERATOR = 1 | |
def to_rpn(expr): | |
rpn = ['', '', ''] | |
state = STATE_OPEREND | |
operend_i = 0 | |
while len(expr) > 0: | |
ch = expr[0] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The script to initial LCD on Raspberry which labeled "3.5 inch rpi lcd v3.0" on backside. | |
# The information is from https://github.com/notro/fbtft/issues/338 | |
sudo modprobe flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 | |
sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you're encountering following error. | |
# > IOError: [Errno 2] No such file or directory: 'C:\\Users\\username\\AppData\\Local\\Temp\\_MEI502322\\openpyxl\\.constants.json' | |
# | |
# This solution tested under Python 2.7.10 and Pyinstaller 3.0. | |
# | |
# Put this file to your script folder. | |
# Add this hook to your distribution by | |
# > pyinstaller --onefile --additional-hooks-dir=. yourscript.py | |
# | |
from PyInstaller.utils.hooks import collect_data_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# coding: utf-8 | |
import win32api | |
import win32file | |
# Available driver types: | |
# win32file.DRIVE_UNKNOWN => 0 | |
# win32file.DRIVE_NO_ROOT_DIR => 1 | |
# win32file.DRIVE_REMOVABLE => 2 |
OlderNewer