Skip to content

Instantly share code, notes, and snippets.

@spooky
spooky / refresh.html
Created Sep 21, 2018
tiny obj to template binder
View refresh.html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>refresh</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
@spooky
spooky / api.py
Created Jul 19, 2018
hug+datatypes
View api.py
from dataclasses import dataclass, field, asdict
import hug
@dataclass
class Paged:
items: list = field(default_factory=list)
total: int = 0
@spooky
spooky / Builder.cs
Last active Jul 6, 2018
message builder
View Builder.cs
using System;
using System.Collections.Generic;
namespace MsgBuilder
{
public partial class Builder<T>
{
internal class Message : Dictionary<string, T>, IMessage<T>
{
private Builder<T> _builder;
View mass_insert.py
#! /usr/bin/python
import sys
def generate(count=10):
def msg(key, value):
return '*3\r\n$3\r\nSET\r\n${}\r\n{}\r\n${}\r\n{}\r\n'.format(len(key), key, len(value), value)
for i in range(count):
@spooky
spooky / main.py
Created Aug 23, 2017
qml crash after close
View main.py
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine
def run():
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
@spooky
spooky / main.py
Last active Aug 22, 2017
2 way qml binding
View main.py
import sys
from PyQt5.QtCore import QObject, QUrl, pyqtSignal, pyqtSlot, pyqtProperty
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine
class ViewModel(QObject):
text_changed = pyqtSignal(name='textChanged')
View sublime prefs
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Colorsublime - Themes/Muukii.tmTheme",
"fade_fold_buttons": false,
"fold_buttons": true,
"font_face": "Droid Sans Mono",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
View git shell aliases
alias gs='git st'
alias gd='git diff --ignore-all-space'
alias gl='git l'
View .gitconfig
[branch]
autosetuprebase = always
[color]
ui = auto
[alias]
st = status
br = branch
#l = log --pretty=tformat:"%C(yellow)%h\\ %ad%Creset\\ |\\ %s%C(cyan)\\ [%an]\\%Cred%d%Creset" --decorate --graph --abbrev-commit --date=relative
hl = log --pretty=tformat:"%C(yellow)%h\\ %Cgreen(%ad)%Creset\\ -\\ %s%C(cyan)\\ [%an]\\%Cred%d%Creset" --decorate --graph --abbrev-commit --date=relative
ll = log --pretty=tformat:"%C(yellow)%h%Cred%d\\ %Creset%s%C(cyan)\\ [%an]" --decorate --numstat -1
View Application.qml
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.2
import QtMultimedia 5.0
Window {
id: mainWindow
title: "QApplication"