Skip to content

Instantly share code, notes, and snippets.

foreach($i in ls -recurse -Include *.asp,*.js,*.html,*.css) {
$temp = get-content $i.fullname
out-file -filepath $i.fullname -inputobject $temp -encoding utf8 -force
}
@zhangw
zhangw / interfaces
Created June 5, 2014 08:23
the network interfaces configuration in ubuntu
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The secondary network interface
auto eth1
/*
Copyright 2014 Levi Gross. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@zhangw
zhangw / ord_unichr_unicode_char
Created August 28, 2014 11:02
convert unicode one-character to integer,return unicode one-character with ordinal integer.
#unicode character
char = u'\u2708'
print char
#integer value of the character
ord_char = ord(char)
print ord_char,hex(ord_char)
#return the character
uni_char = unichr(ord_char)
assert(char==uni_char)
print uni_char
description "PostgreSQL 9.1 Server"
author "PostgreSQL"
start on runlevel [2345]
stop on runlevel [016]
expect fork
respawn
env POSTGRESQL_HOME="/var/lib/postgresql/9.1/main"
@zhangw
zhangw / vimrc
Last active August 29, 2015 14:21
vimrc_download
wget --no-check-certificate https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/basic.vim -O ~/.vimrc && cat ~/.vimrc
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
{
"name": "my-app",
"version": "0.0.0",
"dependencies": {
"browserify": "~2.36.1",
"less": "~1.5.1"
},
"devDependencies": {
"watchify": "~0.4.1",
"catw": "~0.2.0"
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
import email
def get_decoded_email_body(message_body):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1