Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / ASUS_WindowsMetrics.reg
Last active December 30, 2022 20:24
menu font too small
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
"BorderWidth"="-15"
"CaptionFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"CaptionHeight"="-330"
"CaptionWidth"="-330"
@stephenquan
stephenquan / node-https-config.js
Last active April 18, 2018 00:32
node-https.js
module.exports = {
port: 8080,
createOptions: {
name: 'Http Server',
version: '1.0.0'
},
bodyParserOptions: {
uploadDir: '/tmp/node_https',
keepExtensions: true
}
@stephenquan
stephenquan / psql_demo.sh
Created April 30, 2018 05:08
psql_demo.sh
# Demonstrates psql command line client on Ubuntu machines
# See: https://www.postgresql.org/download/linux/ubuntu/
cat $HOME/.pgpass <<EOF
$PGHOST:5432:$PGINST:$PGUSER:$PGPASS
EOF
psql -h $PGHOST -p 5432 -U $PGUSER $PGINST -t -f - <<EOF
drop table primes;
create table primes (
@stephenquan
stephenquan / appstudio-active-networks.qml
Created May 3, 2018 05:34
appstudio-active-networks.qml
import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Networking 1.0
Item {
Flickable {
anchors.fill: parent
contentWidth: textArea.width
contentHeight: textArea.height
@stephenquan
stephenquan / SortedListModel.qml
Last active April 23, 2019 08:27
SortedListModel.qml
// Implements a convenient ListModel that contains sorted items.
//
// properties:
// sortKey: specifies one or more key to sort on with an optional "-" prefix to set descending order
// compareFunc: allows you to replace the default compare function with your own
//
// methods:
// insertSorted(obj) - uses binary search insertion sort, duplicates aren't allowed, last in wins.
// sort() - leverages from Array.prototype.sort() to rapidly sort all items to a new compareFunc
// load() - load from another model
@stephenquan
stephenquan / appstudio-filefolder-check.qml
Last active January 24, 2019 23:19
appstudio-filefolder-check.qml
import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0
Item {
TextField {
text: AppFramework.userHomeFolder.filePath(":/abc.txt")
}
}
@stephenquan
stephenquan / ResourceCopyTest.pro
Last active May 18, 2018 02:05
ResourceCopyTest
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
@stephenquan
stephenquan / flatjson.py
Last active July 16, 2018 03:05
flatjson.py
import json, sys
def combine(attr, prefix):
return attr if prefix == "" else prefix + "." + attr
def flatjson(obj, prefix = ""):
if isinstance(obj, list):
print combine("len", prefix) + "\t" + str(len(obj))
for i, row in enumerate(obj):
flatjson(obj[i], prefix + "[" + str(i) + "]")
@stephenquan
stephenquan / aamva_decode.js
Last active July 4, 2018 02:05
aamva_decode.js
// Convert AAMVA string to JSON
function aamva_decode(data) {
var m = data.match(/^@\n\u001e\r(ANSI )(\d{6})(\d{2})(\d{2})(\d{2})/);
if (!m) {
return null;
}
var obj = {
header: {
@stephenquan
stephenquan / CertTest.qml
Created October 31, 2018 22:02
CertTest.qml
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import Qt.Test 1.0
Window {
visible: true
width: 640
height: 480