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
sudo openssl req -new -x509 -keyout dev.pem -out dev.pem -days 3650 -nodes |
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
CmdUtils.CreateCommand({ | |
names: ["ruby search"], | |
icon: "http://www.ruby-doc.org/favicon.ico", | |
description: "search ruby-doc.org using google", | |
help: "ruby <keyword>.", | |
author: {name: "joel hansson", email: "joel.hansson'at'gmail.com"}, | |
license: "GPL", | |
homepage: "http://gottfolk.se", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function preview(pblock, args) { |
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
class Foo | |
def self.set(params) | |
puts "setting myparams = #{params}" | |
@my_params = params | |
end | |
def self.save_str | |
puts "my_param: '#{@my_params}'" | |
sleep(1) |
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 serial | |
import struct | |
from optparse import OptionParser | |
parser = OptionParser(usage="hurra") | |
parser.add_option("-p",default="hello world") |
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 sanitize_xml(str) | |
replaces = [ | |
["<","<"], | |
[">",">"], | |
["\"","""], | |
["\'","'"], | |
["&","&"] | |
] | |
replaces.each{|e| str.gsub!(e[1],e[0]) } | |
replaces.reverse.each{|e| str.gsub!(e[0],e[1])} |
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 > $d = new DateTime(); | |
php > $d->setTimestamp(1288565940); | |
php > echo $d->format('Y/m/d H:i'); | |
2010/10/31 23:59 | |
php > $d->modify('-1 month'); | |
php > echo $d->format('Y/m/d H:i'); | |
2010/10/01 23:59 |
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
qzio@saito:~/public/notr[master]$ export RACK_ENV=production | |
qzio@saito:~/public/notr[master]$ echo $RACK_ENV | |
production | |
qzio@saito:~/public/notr[master]$ irb | |
ruby-1.9.2-p0 > ENV["RACK_ENV"] | |
=> "production" | |
ruby-1.9.2-p0 > quit | |
qzio@saito:~/public/notr[master]$ echo $PADRINO_ENV | |
qzio@saito:~/public/notr[master]$ RACK_ENV=production padrino console |
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 | |
$a = array("name" => "simon", "email" => "[email protected]", "homepage" => "http:////**sunet.se", "age" => "twentynine"); | |
$validate = new Validator($a); | |
$validate->ensure("name", "")->isLen(5)->isAlpha(); | |
$validate->ensure("email")->isEmail(); | |
$validate->ensure("homepage", "Homepage is wr00ng!")->isUrl(); | |
$validate->ensure("age")->isInt(); |
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
$ ./pecl-manager.php -c config-single.ini -w ./worker-classes-ext -vvv | |
PID Type Message | |
27106 INFO Loading workers in ./worker-classes-ext | |
27107 PROC Helper forked | |
27107 INFO Loading workers in ./worker-classes-ext | |
27106 PROC Started with pid 27106 | |
27106 PROC Started child 27108 (another_test_job,test_job) | |
27108 WORKER Adding server 127.0.0.1 | |
27108 WORKER Adding job another_test_job | |
27108 WORKER Adding job test_job |
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 | |
for v in $( say -v '?' | awk '{print $1}') ; do | |
echo "voice $v" | |
mystring="$(say -v '?' | grep "$v" | awk '{$1=$2=$3="";print}')" | |
say -v "$v" "Hello, my name is ${v}. $mystring" | |
sleep 0.5 | |
done |