Skip to content

Instantly share code, notes, and snippets.

View khsing's full-sized avatar
🎯
Focusing

Guixing Bai khsing

🎯
Focusing
View GitHub Profile
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"
@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()
@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.
#!/bin/sh
cd `dirname $0`
LOG=/tmp/yummirror.log
echo "Start at:: `date \"+%Y-%m-%d %H:%M:%S\"`" > $LOG
for os_ver in 4 5;do
for os_arch in i386 x86_64;do
for centos_repo in os updates;do
mkdir -pv centos/$os_ver/$centos_repo/$os_arch 2>&1 >> $LOG
rsync -rtv rsync://ftp.heanet.ie/pub/centos/RPM-GPG-KEY-CentOS-$os_ver centos/ 2>&1 >> $LOG
rsync -rtv rsync://ftp.heanet.ie/pub/centos/$os_ver/$centos_repo/$os_arch centos/$os_ver/$centos_repo/ 2>&1 >> $LOG
#!/bin/sh
#
# Created by Bjorn Nelson 051222
#
# Description: fetch distfiles (more up to date then mirroring freebsd mirrors)
# Set these variables
PORTSDIR="/usr/ports"
IGNOREFILES=". Tools work files Mk Templates distfiles"
SUBPROC=30
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Info:
Latest version: http://forums.gentoo.org/viewtopic-p-6183606.html#6183606
xeffects thread: http://forums.gentoo.org/viewtopic-t-511382.html
Alternative: https://wiki.ubuntu.com/Fonts
http://wiki.archlinux.org/index.php/XOrg_Font_Configuration
http://antigrain.com/research/font_rasterization/index.html
@khsing
khsing / hack.sh
Created April 5, 2012 04:10 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@khsing
khsing / Markdown.pl.patch
Created August 21, 2012 10:38
patch to support strike for MT's markdown
--- mt.bk/plugins/Markdown/Markdown.pl 2012-05-10 05:03:28.000000000 -0400
+++ mt/plugins/Markdown/Markdown.pl 2012-08-21 04:29:37.000000000 -0400
@@ -971,6 +971,10 @@
$text =~ s{ (\*|_) (?=\S) (.+?) (?<=\S) \1 }
{<em>$2</em>}gsx;
+ # These lines added by Bill Eccles, 2008-07-04
+ $text =~ s{ (\s) (~~) (?=\S) (.+?) (?<=\S) (~~) }
+ {$1<strike>$3</strike>}gsx;
+
@khsing
khsing / mactips.sh
Last active June 24, 2024 20:35
some hacks for mac
#!/bin/bash
# curl -skL https://gist.github.com/khsing/6697187/raw/mactips.sh | bash
# "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Allow Finder quit.
defaults write com.apple.finder QuitMenuItem -bool true