This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
for param in os.environ.keys(): | |
print "%20s %s" % (param,os.environ[param]) | |
# from http://www.wellho.net/resources/ex.php4?item=y115/penv.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# remove cr and ^Z characters from a dos file: | |
# the codes are octal, oct15 = dec13 and oct32 = dec26 | |
tr -d '\15\32' < winfile.txt > unixfile.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir -p /tmp/ramdisk | |
sudo mount -t tmpfs -o size=512M tmpfs /tmp/ramdisk | |
#sudo mount -t tmpfs -o size=1G tmpfs /tmp/ramdisk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat some.conf | sed 's/^[ \t]*//' |grep -v ^# | sed '/^$/d' | |
# as result all non-blank lines from some.conf that do not start with a "#" (which means this only a comment line) are printed to the terminal | |
# in short: show the lines that contain something relevant | |
# the first sed removes trailing spaces from all lines | |
# the grep removes all lines that start with a "#" | |
# the second sed removes all blank lines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Connecting to MySQL Server ... "; | |
mysql_connect( | |
"localhost", | |
"admin", | |
"pass123") | |
or die(mysql_error()); | |
echo "[OK]<br />"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# recipe-137951-1.py | |
# from http://code.activestate.com/recipes/137951-dump-all-the-attributes-of-an-object/ | |
# created by (C) Philip Kromer http://code.activestate.com/recipes/users/552075/ | |
# forked as https://gist.github.com/1291055 | |
# licence = psf http://code.activestate.com/recipes/tags/meta:license=psf/ | |
# On python attributes and methods read: http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html | |
from cStringIO import StringIO | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
""" | |
Save this file as c:\Python24\Lib\docprint.py or in your application or library directory. | |
File is maintained as a gist at github: https://gist.github.com/1334355 | |
""" | |
def write(txt): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decode_guess(s, etypes=('utf8','latin1','ascii')): | |
""" | |
Returns an unicode object | |
""" | |
for et in etypes: | |
try: | |
return s.decode(et) | |
except UnicodeDecodeError: | |
pass | |
return s.decode('ascii', 'ignore') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<title>Hier entsteht eine neue Internetpräsenz!</title> | |
<style type="text/css"> | |
#message { | |
font-size: 250%; | |
color: #546354; | |
font-family: Arial, Helvetica, sans-serif; |