Skip to content

Instantly share code, notes, and snippets.

@shellexy
shellexy / 谷歌拼音最大输入长度.diff
Created September 4, 2011 12:22
ibus-googlepinyin 输入词的最大长度由 9 改为 16
diff --git a/include/spellingtrie.h b/include/spellingtrie.h
--- a/include/spellingtrie.h
+++ b/include/spellingtrie.h
@@ -30,8 +30,8 @@ struct SpellingNode {
SpellingNode *first_son;
// The spelling id for each node. If you need more bits to store
// spelling id, please adjust this structure.
- uint16 spelling_idx:11;
- uint16 num_of_son:5;
+ uint16 spelling_idx;
@shellexy
shellexy / 页面导航栏 bookmarklet.js
Created September 30, 2011 12:46
页面导航栏 bookmarklet
javascript: (function() {
NodeList.prototype.forEach = Array.prototype.forEach;
var navId = 'shellexy_html5nav_bar';
if (nav = document.getElementById(navId)) {
document.body.style.marginLeft = document.body.getAttribute('marginLeft');
return nav.parentElement.removeChild(nav);
}
if (!document.styleSheets.length) {
document.body.appendChild(document.createElement('style'));
}
@shellexy
shellexy / altTheme.tcl
Created October 2, 2011 09:52
修改后的 Tk ttk 主题颜色
#
# $Id: altTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $
#
# Ttk widget set: Alternate theme
#
namespace eval ttk::theme::alt {
variable colors
array set colors {
@shellexy
shellexy / gitg-0.2.5-new-ui.diff
Created October 8, 2011 15:20
gitg 界面补丁,将标签栏移至左侧,调整控件边距,让详情栏随 diff 栏滚动以增大可视面积(更新到 gitg 0.2.5
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index fa30e52..6e2b0e1 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -297,6 +297,7 @@ add_revision_panel (GitgWindow *window,
label = gitg_revision_panel_get_label (panel);
label_widget = gtk_label_new (label);
+ gtk_label_set_angle (GTK_LABEL(label_widget), 90);
gtk_widget_show (label_widget);
@shellexy
shellexy / Ambiance.diff
Created October 15, 2011 12:59
给 11.10 的 Ambiance 主题加上浅黄色
diff --git a/Ambiance/gtk-2.0/gtkrc b/Ambiance/gtk-2.0/gtkrc
--- a/Ambiance/gtk-2.0/gtkrc
+++ b/Ambiance/gtk-2.0/gtkrc
@@ -1,4 +1,4 @@
-gtk-color-scheme = "base_color:#ffffff\nfg_color:#4c4c4c\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\nselected_fg_color:#FFFFFF\ntext_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#000000\nlink_color:#DD4814"
+gtk-color-scheme = "base_color:#f5f5f5f5b5b5\nfg_color:#4c4c4c\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\nselected_fg_color:#FFFFFF\ntext_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#000000\nlink_color:#DD4814"
gtk-icon-sizes = "panel-menu=22,22:gtk-button=16,16"
diff --git a/Ambiance/gtk-3.0/settings.ini b/Ambiance/gtk-3.0/settings.ini
@shellexy
shellexy / stardict 的 GtkStatusIcon 系统托盘.diff
Created October 16, 2011 13:19
让 stardict 用 GtkStatusIcon 代替 EggTrayIcon 作为系统托盘图标
diff --git a/stardict-3.0.1/src/docklet.cpp b/stardict-3.0.1/src/docklet.cpp
--- a/stardict-3.0.1/src/docklet.cpp
+++ b/stardict-3.0.1/src/docklet.cpp
@@ -24,30 +24,12 @@ DockLet::DockLet(GtkWidget *mainwin, boo
void DockLet::create_docklet()
{
- docklet_ = egg_tray_icon_new("StarDict");
- box_ = gtk_event_box_new();
- if (is_hide_state()) {
@shellexy
shellexy / nautilus 不显示桌面菜单栏.diff
Created October 26, 2011 13:53
让 nautilus 在桌面没有使用 appmenu 时不要显示多余的屏幕顶部菜单栏
diff --git a/nautilus-3.2.0/src/nautilus-desktop-window.c b/nautilus-3.2.0/src/nautilus-desktop-window.c
--- a/nautilus-3.2.0/src/nautilus-desktop-window.c
+++ b/nautilus-3.2.0/src/nautilus-desktop-window.c
@@ -246,6 +246,11 @@ nautilus_desktop_window_constructed (GOb
g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
G_CALLBACK (nautilus_desktop_window_update_directory),
window);
+
+ GtkWidget * menubar_parent = gtk_widget_get_parent (NAUTILUS_WINDOW (window)->details->menubar);
+ GtkWidget * menubar_viewport = gtk_viewport_new (NULL, NULL);
@shellexy
shellexy / paveo-uuid.sh
Created October 28, 2011 15:25
P 大说:要把一个文件里的全部 UUID 字符串全部 替换 成新的 UUID 字符串,每个 UUID 不能一样
#!/bin/bash
paveo(){
REG="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
CMD=""
for i in `sed -rn "/$REG/=" $1 `
do
CMD="$CMD ; ${i}s/$REG/`uuid`/"
done
sed -r -i "$CMD" $1;
@shellexy
shellexy / get_chromium_snapshots.sh
Created November 7, 2011 13:47
下载 chromium 每日构建版
#!/bin/sh
get_chromium_snapshots(){
# 获取 snapshots 版 chromium-browser
VERSION="`wget -O- -nv http://build.chromium.org/f/chromium/snapshots/chromium-linux-reliability/LATEST`"
URL="http://build.chromium.org/f/chromium/snapshots/chromium-linux-reliability/$VERSION/chrome-linux.zip"
## 考虑已经下载的情况
touch VERSION
[ "`cat VERSION`" == $VERSION ] && return
## 下载
@shellexy
shellexy / pygirconsole.py
Created November 15, 2011 12:38
提供 PyGtk3 的交互 shell
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- Mode: python; c-basic-offset: 4 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
'''Interactive Python Gir (Gtk3) Console
@author: Jiahua Huang <jhuangjiahua@gmail.com>
@license: LGPLv3+
'''