Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / .gitconfig
Last active March 27, 2024 00:57
dot files
[user]
name = x
email = x
[push]
default = simple
followTags = true
[diff]
tool = vscode
[merge]
tool = vscode
@oglops
oglops / fix_tomato_gui_clean.py
Last active September 24, 2017 06:27
restore leading spaces/tabs/newlines from original www files
import os
import re
cn_dir = '~/github/tomato-gui'
en_dir = '~/github/tomato-gui-en'
cn_dir = os.path.expanduser(cn_dir)
en_dir = os.path.expanduser(en_dir)
@oglops
oglops / build.sh
Created July 13, 2017 21:23
build svn in csh
# build serf lib first
scons PREFIX=$HOME/Downloads/serf-install
scons install
# run one line command with temp env var
( make distclean ; setenv LDFLAGS -Wl,-rpath,\\\$\$ORIGIN/../lib ; ./configure --prefix=$HOME/svn --with-serf=$HOME/Downloads/serf-install ; make ; make install)
cd /home/oglop/tomato/release/src-rt/router/libjson-c && CC=mipsel-uclibc-gcc STRIP=mipsel-uclibc-strip \
./autogen.sh && \
./configure --host=mipsel-linux --build=x86_64-redhat-linux --prefix=/usr
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader
@oglops
oglops / gist:7120f0fcd1a9be31959221b4caf048c4
Created July 4, 2017 06:03 — forked from manuelmacha/gist:6cc29ec040734e21a768
QTextEdit extended with a signal 'lineNumbersChanged' which gets triggered when the line-numbers of the visible text change. Such functionality already exists for QPlainTextEdit via firstVisibleBlock().blockNumber() and lastVisibleBlock().blockNumber(). However these methods are not accessible using QTextEdit and PyQt. The signal can be used to …
from PyQt4 import QtGui, QtCore
class TextEdit(QtGui.QTextEdit):
'''
QTextEdit extended with a signal 'lineNumbersChanged' which gets triggered when the line-numbers of the visible text change.
Such functionality already exists for QPlainTextEdit via firstVisibleBlock().blockNumber() and lastVisibleBlock().blockNumber()
However these functions are not accessible using QTextEdit and PyQt.
The signal can be used to update custom widgets that compliment the QTextEdit such as lineNumberWidgets or miniMapWidgets.
'''
@oglops
oglops / gifplayer.html
Last active July 2, 2017 00:23
qwebview load() does not need to load js and css manually
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gifplayer</title>
<base href="http://rubentd.com"></base>
<link rel="stylesheet" type="text/css" href="bower_components/jquery.gifplayer/dist/gifplayer.css"></link>
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/jquery.gifplayer/dist/jquery.gifplayer.js"></script>
<script>
@oglops
oglops / 1.html
Created June 30, 2017 22:03
qwebview visited link color not changing ?
<html>
<head>
<title></title>
<meta content="">
<style></style>
</head>
<body>
page 1
<a href="2.html"> open page 2</a>
</body>
@oglops
oglops / gifplayer.css
Last active June 29, 2017 06:57
use gifplayer jquery plugin in qwebview to control gif, user-select: none; hides blinking text cursor when used in an editable qwebview
ins.play-gif{
position: absolute;
font-family: Arial, sans serif;
width: 50px;
height: 50px;
line-height: 52px;
text-align: center;
background: #222;
font-size: 18px;
@oglops
oglops / pyqt4_webkit_video_css.py
Created June 27, 2017 06:42
Load one or multiple css files into qwebview
import sys
from PyQt4.QtWebKit import QWebView, QWebInspector, QWebSettings
from PyQt4.QtGui import QApplication, QDialog, QHBoxLayout
from PyQt4.QtCore import QUrl, QByteArray, QString
class Dialog(QDialog):
def __init__(self, parent=None):
@oglops
oglops / mayaWidgetEmbeddingIntoPyQtWidget.py
Created May 16, 2017 18:20 — forked from KelSolaar/mayaWidgetEmbeddingIntoPyQtWidget.py
Maya Widget Embedding Into PyQt Widget
import maya.OpenMayaUI
import maya.cmds as cmds
import sip
from PyQt4.QtGui import *
from PyQt4.QtCore import *
mainWindow = QMainWindow()
centralWidget = QListView()
mainWindow.setCentralWidget(centralWidget)
dockWidget = QDockWidget("DockWidget", mainWindow)