Skip to content

Instantly share code, notes, and snippets.

@snyh
snyh / anbox.install.deepin
Created April 14, 2017 05:29
install anbox in deepin 2015.4
wget https://raw.githubusercontent.com/anbox/anbox-installer/84b3ea95ebfa71723a62eb9291d62884b9306555/installer.sh -O install.sh
patch install.sh <<EOF
26c26
< SUPPORTED_DISTROS=("Ubuntu" "LinuxMint" "neon" "elementary")
---
> SUPPORTED_DISTROS=("Ubuntu" "LinuxMint" "neon" "elementary", "Deepin")
148c148
< sudo apt install -y software-properties-common linux-headers-generic
---
package main
import (
"bytes"
"fmt"
"github.com/disintegration/imaging"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
"image"
@snyh
snyh / containerOf
Created June 30, 2016 00:47
Implement simple containerOf in Golang
package main
import (
"fmt"
"unsafe"
)
// the dummy struct
type B struct {
dummy int
{
"testdef_repos": [
{
"git-repo": "https://github.com/x-deepin/network-testing-experiments.git",
"parameters": {
"ADAPTER_TYPE": "wired",
"IPERF3_SERVER": "10.0.3.133",
"TIME": 30
},
"testdef": "network-testing-wired.yaml"
@snyh
snyh / repo_guard.go
Last active September 18, 2018 13:21
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"time"
1 Why we don't use server side choosing mirror?
═══════════════════════════════════════════════
The IP address family can't reflect the connection status between
mirror server and the user, especially in China.
We belive Only the user side can make the best choose.
2 How deepin solve the problem?
diff --git a/datetime/timezone/timestamp.c b/datetime/timezone/timestamp.c
index 6ddb230..53a8857 100644
--- a/datetime/timezone/timestamp.c
+++ b/datetime/timezone/timestamp.c
@@ -31,7 +31,7 @@
static int isdst_timestamp(time_t t);
-DSTTime*
+DSTTime
@snyh
snyh / gist:7bfab3f65b2642505915
Created July 2, 2014 00:57
associate touchscreen and output under deepin2014
Normal you don't need this unless you work with multi-head and touchscreen. Below steps will associate your devices when things changed.
First, find the *touchscreen device* name. run "xinput | grep -i touchscreen"
and results will be similar to this:
"⎜ ↳ ELAN Touchscreen id=11 [slave pointer (2)]"
the "ELAN Tochscreen" or "11" can be used as device name.
@snyh
snyh / ReadXSettings.go
Last active September 18, 2018 13:21
//this simple file show you how to read the XSettings properties (http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html)
package main
import "fmt"
import "github.com/BurntSushi/xgb/xproto"
import "github.com/BurntSushi/xgb"
import "encoding/binary"
import "io"
import "bytes"
@snyh
snyh / no_proc_self_exe.c
Created December 17, 2013 02:34
it's show that /proc/`pid`/exe is not always valid.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#define NUM_THREADS 5
void func(void *a)
{
printf("/proc/%ld/exe\n", getpid());