Skip to content

Instantly share code, notes, and snippets.

" MINIMAL VERSION WITHOUT ANY DEPENDENCY
" For compatibility's sake, all defaults that are different between Vim and
" Neovim are excplicity specified again.
" look and feel
set t_Co=256
set background=dark
" remove windows toolbar
ffmpeg -i input.aifc -ac 1 mono_output.m4a
_DEFAULTS = [
a : '123',
b : '456',
c : []
]
def foo = [ a : '789', c : ['000', '111', 222] ]
def getTemplate() {
return """
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtWidgets import QApplication, QLabel
import sys
from cv2 import VideoCapture
if __name__ == '__main__':
qa = QApplication(sys.argv)
ql = QLabel()
@metaphox
metaphox / QtPlayer.py
Last active June 17, 2023 19:21
probing frame number
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
#!/bin/bash
SCRIPTNAME=`basename "$0"`
print_help() {
cat << EOF
Usage: $SCRIPTNAME filename
Uses 'inotifywait' to sleep until 'filename' has been modified.
Inspired by http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes/181543#181543
@metaphox
metaphox / convert.py
Last active January 9, 2017 17:01
grab all my zhihu.com answers
import sys, json, datetime
if len(sys.argv) < 2:
filename = 'myzhihuanswers.json'
else:
filename = sys.argv[1]
with open(filename) as jsonfile:
lines = jsonfile.readlines()
i = 0
for pageline in lines:
@metaphox
metaphox / System Design.md
Created April 18, 2016 12:01 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@metaphox
metaphox / what-forces-layout.md
Last active September 19, 2015 11:15 — forked from paulirish/what-forces-layout.md
What forces layout/reflow in Chrome. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@metaphox
metaphox / bling.js
Last active June 14, 2020 00:30 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype