Skip to content

Instantly share code, notes, and snippets.

/**
* Copyright (c) 2011 ~ 2012 Deepin, Inc.
* 2011 ~ 2012 jouyouyun
*
* Author: jouyouyun <[email protected]>
* Maintainer: jouyouyun <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
static gboolean
set_layouts_from_gsettings (void)
{
gchar **kbd_layout = NULL;
GSettings *kbd_set = NULL;
guint len = 0;
gboolean is_ok;
kbd_set = g_settings_new ("org.gnome.libgnomekbd.keyboard");
kbd_layout = g_settings_get_strv (kbd_set, "layouts");
@jouyouyun
jouyouyun / ex1.go
Created November 5, 2013 10:02
Go Exercises
package main
import (
"fmt"
)
func Sqrt (x float64) float64 {
z := 0.0
for i := 0; i < 10; i++ {
@jouyouyun
jouyouyun / error
Created November 19, 2013 06:19
error
# dlib/dbus/property
/usr/lib/go/src/pkg/dlib/dbus/property/normal_property.go:3: imported and not used: "dlib"
/usr/lib/go/src/pkg/dlib/dbus/property/normal_property.go:15: too many arguments to conversion to NormalProperty: NormalProperty(v, reflect.TypeOf(v), nil)
@jouyouyun
jouyouyun / err
Created November 21, 2013 01:15
error
proxyer -in desktop.in.json -out desk -target QML 2 ↵
2013/11/21 09:14:58 d: com.deepin.daemon.Desktop i: com.deepin.daemon.Desktop e: Desktop
panic: exit status 1
goroutine 1 [running]:
runtime.panic(0x5b5b80, 0xc210000538)
/usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
main.testQML()
/home/caicai/GoLang/src/dlib/dbus/proxyer/template_qml.go:309 +0x1f9
main.func·001()
@jouyouyun
jouyouyun / parse.go
Created December 14, 2013 06:59
test xml
/**
* Copyright (c) 2011 ~ 2013 Deepin, Inc.
* 2011 ~ 2013 jouyouyun
*
* Author: jouyouyun <[email protected]>
* Maintainer: jouyouyun <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
package main
import (
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("dbus-send", "--type=method_call", "--dest=com.deepin.dde.dock", "/com/deepin/dde/dock com.deepin.dde.dock.ToggleShow")
_, err := cmd.Output()
@jouyouyun
jouyouyun / test.c
Created January 20, 2014 09:50
cgo test
#include "test.h"
void SetFunc()
{
InternalFunc();
}
@jouyouyun
jouyouyun / test-window.go
Created January 27, 2014 08:33
Test Window
package main
import (
"fmt"
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
func main() {
X, err := xgb.NewConn()
@jouyouyun
jouyouyun / test.go
Created February 17, 2014 08:09
Golang Post Test
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)