Skip to content

Instantly share code, notes, and snippets.

import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(200,100))
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
self.CreateStatusBar() # A Statusbar in the bottom of the window
# Setting up the menu.
filemenu= wx.Menu()
@fcwu
fcwu / hello.py
Created June 17, 2013 03:34
python, gtk 3 and CSS
#!/usr/bin/python3
from gi.repository import Gtk, Gdk
import sys
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Hello World")
self.set_name('MyWindow')
@fcwu
fcwu / power.sh
Created June 27, 2013 08:47
Linux power statistics
#!/bin/sh
echo "current average capacity full_capacity time_left"
factor=0.7
last_pwr=0
charge_full=`cat /sys/class/power_supply/BAT0/charge_full`
voltage_min_design=`cat /sys/class/power_supply/BAT0/voltage_min_design`
full_pwr=`echo "scale=5; $charge_full * $voltage_min_design / 1000000 / 1000000" | bc`
while [ 1 ]; do
voltage_now=`cat /sys/class/power_supply/BAT0/voltage_now`
@fcwu
fcwu / 99-kylin.sh
Created July 26, 2013 09:54
dell-recovery phase 2 patch. Please put it into scripts/chroot-scripts/os-post/99-kylin.sh
#!/bin/dash
set -e
WDIR=/tmp/kylin
rm -rf ${WDIR}
Exit ()
{
echo "cleanup"
@fcwu
fcwu / bt-usb3
Created September 4, 2013 08:49
Put in /etc/pm/power.d to route BT to ehci
#!/bin/sh
# Allow the driver to put the audio hardware to sleep
# once the driver has been inactive for a second.
# This hook should work with at least the ac97 and hda codecs.
help() {
cat <<EOF
--------
$0: Intel Audio powersave parameters.
@fcwu
fcwu / add_usb3_switch_boot_parameter.patch
Created September 4, 2013 09:53
diff linux-lts-quantal-3.5.0/drivers/usb/host/pci-quirks.c orig/drivers/usb/host/pci-quirks.c
94,107d93
< u32 intel_xusb2pr = 0xFFFFFFFF;
<
< static int __init intel_xusb2pr_setup(char *str)
< {
< u32 value;
< if (kstrtoul(str, 16, &value)) {
< printk("Failed to convert value=%s\n", str);
< return 1;
< }
#!/usr/bin/python
from lp_fish_tools.SomervilleShare import *
from lp_fish_tools.util import *
from datetime import date
import subprocess
import os
import ConfigParser
/*************
Blue Theme
*************/
/* overall */
.tablesorter-blue {
width: 100%;
background-color: #fff;
margin: 10px 0 15px;
text-align: left;
border-spacing: 0;
@fcwu
fcwu / cdc-acm.c
Created October 20, 2013 14:06
Kernel 3.1.2 cdc-acm.c for ASUSTOR NAS
/*
* cdc-acm.c
*
* Copyright (c) 1999 Armin Fuerst <[email protected]>
* Copyright (c) 1999 Pavel Machek <[email protected]>
* Copyright (c) 1999 Johannes Erdfelt <[email protected]>
* Copyright (c) 2000 Vojtech Pavlik <[email protected]>
* Copyright (c) 2004 Oliver Neukum <[email protected]>
* Copyright (c) 2005 David Kubicek <[email protected]>
* Copyright (c) 2011 Johan Hovold <[email protected]>
@fcwu
fcwu / facebook_login.js
Created October 21, 2013 16:20
Quick login button for facebook via greasemonkey
// ==UserScript==
// @name facebook login
// @namespace http://123.123
// @include https://www.facebook.com/*
// @version 1
// @require http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.2.js
// @require http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js
// @resource bt http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css
// @resource bt-theme http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css
// @grant GM_addStyle