UUIDGEN 解説 Universal IDs (GUID/UUID) — CCPN Plone Site Information Generation of universal IDs is still a developing field, apparently. A quick google turns up http://home.arcor.de/jurner/python/#pkg-uuid-0.3.1 http://sourceforge.net/tracker/index.php?func=detail&aid=1368955&group_id=5470&atid=305470 which are new since Peter sent out his summarising mail For the time being I am using the uuid generator from
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
#!/usr/bin/env python | |
import sys, logging | |
sys.path.insert(0,"./gdata-2.0.11.final.zip/src") | |
from gdata import service | |
import gdata | |
import atom | |
import simplejson |
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/bash -x | |
# https://gist.github.com/755352 | |
for DEV in $( mount | awk '{print $1}'|fgrep /dev/ ) | |
do | |
PUREDEV=$( echo $DEV | cut -d/ -f3- ) | |
UUIDIS=$( ls -l /dev/disk/by-uuid/ | fgrep $PUREDEV | awk '{print $8}' ) | |
fgrep $UUIDIS /etc/fstab || ( | |
echo $UUIDIS | |
echo UUID=$UUIDIS $( mount | fgrep $PUREDEV | awk '{print $3,$5}') defaults,noatime 0 0 | sudo tee -a /etc/fstab | |
) |
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
var pos = document.location.hash.search( /setCanvasHeight/ ) | |
if( pos >= 0 ){ | |
hashvpos = document.location.hash.search( /setCanvasHeight%22%2C%22([0-9]+)px/ ); | |
crop = document.location.hash.substring(hashvpos+24); | |
pxpos = crop.search("px"); | |
heighthack = crop.substring( 0, pxpos ); | |
if( heighthack > 300 ){ | |
newv = document.location.hash.replace( "setCanvasHeight%22%2C%22"+heighthack, "setCanvasHeight%22%2C%22300" ); | |
document.location.hash = newv; | |
} |
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 | |
/** | |
* https://gist.github.com/923041 | |
* | |
* converting between nested object and nested array, bidirectional | |
*/ | |
function object2array( $srcobject , array $exclude_propnames = null ){ | |
assert( gettype($srcobject) == "object" ); |
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 | |
function unicode2utf8($aa){ | |
###var_dump(func_get_args()); | |
return mb_convert_encoding( pack("n", hexdec($aa[1]) ), "utf-8", "ucs2" ); | |
} | |
while( ($f=fgets(STDIN))!==false ){ | |
$a = str_replace('\\','\',$a ); | |
$a = preg_replace_callback('/\\\u([a-f0-9]{4})/i', "unicode2utf8", $f ); |
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
#!python | |
def dict2list(dict1): | |
assert isinstance(dict1,dict) | |
indexes = sorted(dict1.keys()) | |
## try: | |
[ int(xx) for xx in indexes ] # validation: all keys is integer | |
assert indexes[0] == 0 and indexes[-1] == len(indexes)-1, "can not convert to list" | |
return [ dict1[xx] for xx in indexes ] |
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,os, time | |
timeo = os.stat(sys.argv[0]) | |
DEBUGMODE = ( time.time() - timeo.st_mtime ) < 60 |
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
#! https://gist.github.com/4502712 |
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 -x | |
PART=$1 | |
MSIZE=${2-20} | |
FS=${3-ext4} | |
SIZE=$( expr $MSIZE \* 1024 \* 1024 ) | |
LAST=$( expr $SIZE - 1 ) | |
dd if=/dev/zero bs=1k count=1 seek=$LAST of=/host/linuxmint/$PART.disk | |
mkfs.$FS /host/linuxmint/$PART.disk || exit 9 | |
ls -l /host/linuxmint/$PART.disk | |
du -sm /host/linuxmint/$PART.disk |