This file contains 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 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 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 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 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 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 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 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; |
This file contains 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
locale-gen en_US.UTF-8 | |
locale-gen de_DE.UTF-8 | |
/usr/sbin/update-locale LANG=en_US.UTF-8 | |
dpkg-reconfigure tzdata | |
# (select timezone) | |
sudo aptitude update | |
sudo aptitude safe-upgrade |