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
// Stop | |
mysqladmin -u root -p shutdown | |
// Start | |
./bin/safe_mysqld & |
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
python -m SimpleHTTPServer 8000 |
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
You could use: | |
sorted(dictionaryObject.items(), key=lambda x: x[1] ) |
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
for i in *.JPG; do mv $i ${i%.JPG}.tmp; done |
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
(define string-replace | |
(lambda (s match replacement) | |
(let ((ll (string->list s)) | |
(match1 (char match)) | |
(replacement1 (char replacement))) | |
(if (= (string-length match) 1) | |
(let ((z (map (lambda (x) | |
(if (equal? x match1) | |
replacement1 | |
x)) |
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
(let loop ((i 0) | |
(j 20) ;; comparison value: it decreases at each recursion (except the first one) | |
(topvalue 20)) ;; komodo value : must be equal to j at the beginning | |
(let ((txt "Toyota denies previous banking problem is safety")) | |
(if (equal? (- topvalue i) j) ;; the first time | |
(loop (+ i 1) j topvalue) | |
(begin (print (substring txt (- topvalue i) j)) | |
(if (string=? (substring txt (- topvalue i) j) " ") | |
(string-append (substring txt 0 (- topvalue i)) | |
"\n" |
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
(define-macro (p r . otherstuff) | |
`(if (null? (list ,@otherstuff)) | |
(print ,r) | |
(print ,@otherstuff))) | |
(p 'c 'ciao) |
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
<html> | |
<body> | |
<input type="text" id="clock" /> | |
<script language=javascript> | |
var int=self.setInterval("clock()",1000); | |
function clock() | |
{ | |
var d=new Date(); | |
var t=d.toLocaleTimeString(); |
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 string | |
colors = ("00", "33", "66", "99", "CC", "FF") | |
masks = ("#00~00", "#~~00", "#~0000", "#~00~", "#0000~", "#00~~", "#FF~00", "#~~~") | |
f = open("colortest-gradation.html", 'w') | |
f.write("<html><head><title>RGB Gradation</title></head><body bgcolor='black'><tt><b>") | |
f.write("<p><font color='white'>Gentle gradations through RGB color:</font></p>\n") |
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 string | |
def make_color_tuple( color ): | |
""" | |
turn something like "#000000" into 0,0,0 | |
or "#FFFFFF into "255,255,255" | |
""" | |
R = color[1:3] | |
G = color[3:5] | |
B = color[5:7] |