Skip to content

Instantly share code, notes, and snippets.

import socket
s = socket.socket(socket.AF_UNIX)
addr = "\0org.snyh.test"
s.bind(addr)
while(True):
pass
# use netstat -anp | grep snyh
# to verify it
@snyh
snyh / twoway.qml
Created December 6, 2013 08:05
qml property twoway sync.
import QtQuick 2.0
import QtQuick.Controls 1.0
Column {
CheckBox {
id:a1
text:"A1"
Binding { target :a2; property: "checked"; value:a1.checked }
}
@snyh
snyh / dui.go
Last active December 23, 2015 22:09
package main
import "dui"
import "fmt"
import "io/ioutil"
func main() {
dui.Init()
f := dui.NewFrame(300, 300)
@snyh
snyh / distance_random.py
Created December 12, 2012 14:02
generate random element from an list with gurantee at least "n" element is not same. (n is default the length of the list)
import random
class DistanceRandom:
def __init__(self, v_range, v_distance=None):
if v_distance == None:
v_distance = len(v_range)
assert(len(v_range) >= v_distance >= 1)
self.freshed = v_range
self.dist = v_distance
self.used = []