Skip to content

Instantly share code, notes, and snippets.

View khsing's full-sized avatar
🎯
Focusing

Guixing Bai khsing

🎯
Focusing
View GitHub Profile
@khsing
khsing / gist:127646
Created June 11, 2009 01:48
set time
#!/usr/bin/python
from socket import *
import struct,os,time,sys
# Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP
# time server. Run as "setclock.py" to simply print the time from
# the NTP server. Run as "setclock.py --set" to set the Linux
# hardware clock (as the super user, of course).
# Based on Simon Foster's simple SNTP client from ASPN Python cookbook.
@khsing
khsing / gist:126255
Created June 9, 2009 04:02
取dmidecode
#!/usr/bin/env python
# coding: utf-8
import os
def getdmi():
all = []
single = []
for l in os.popen('/usr/sbin/dmidecode'): #replace dmidecode with yours.
l = l.strip()
server.modules = (
"mod_alias",
"mod_cgi",
"mod_rewrite",
"mod_redirect",
"mod_access",
"mod_fastcgi",
"mod_accesslog" )
var.prefix = "/usr/local/lighttpd"
var.mimetype = prefix + "/etc/mimetype.conf"