Skip to content

Instantly share code, notes, and snippets.

View darkslategrey's full-sized avatar

Grégory Faruch darkslategrey

View GitHub Profile
Processing Admin::OverviewController#index (for 127.0.0.1 at 2010-06-10 15:35:08) [GET]
Parameters: {"action"=>"index", "controller"=>"admin/overview"}
Cache miss: Spree::Config ({})
Preference Load (0.5ms) SELECT * FROM `preferences` WHERE (`preferences`.owner_id = 1 AND `preferences`.owner_type = 'Configuration')
Configuration Columns (0.9ms) SHOW FIELDS FROM `configurations`
Configuration Load (0.1ms) SELECT * FROM `configurations` WHERE (`configurations`.`id` = 1)
CACHE (0.0ms) SELECT * FROM `configurations` WHERE (`configurations`.`id` = 1)
Cache write (will save 4.27ms): Spree::Config
Cache hit: Spree::Config ({})
User Load (0.4ms) SELECT * FROM `users` WHERE (`users`.`id` = '1068482874') LIMIT 1
@darkslategrey
darkslategrey / gist:758441
Created December 29, 2010 11:32
Why this TypeError
#### source : deco.py ####
#!/usr/bin/env python
from time import ctime, sleep
def tsfunc(func):
def wrappedFunc():
print "call"
return func()
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
Is that a real opposition ?
Thanks for the pointers.
@darkslategrey
darkslategrey / gist:933607
Created April 21, 2011 03:00
renaming files (names with spaces)
import os
i = 1
for line in open('tmp').readlines():
print line
os.rename(line, "sup_" + str(i))
@darkslategrey
darkslategrey / gist:986983
Created May 23, 2011 16:24
trigger a shell command
DELIMITER //
CREATE TRIGGER tg1 AFTER INSERT ON bugs
FOR EACH ROW
BEGIN
\! echo "php algun_script_php.php" >> /tmp/yourlog.txt;
END//
@darkslategrey
darkslategrey / gist:1367432
Created November 15, 2011 16:02
proxy def
PROXY="http://PROXY_URL:PROXY_PORT"
webdriver.DesiredCapabilities.HTMLUNIT['proxy'] = {
"httpProxy":PROXY,
"ftpProxy":PROXY,
"sslProxy":PROXY,
"noProxy":None,
"proxyType":"MANUAL",
"class":"org.openqa.selenium.Proxy",
"autodetect":False
@darkslategrey
darkslategrey / gist:1391485
Created November 24, 2011 14:40
Selenium test with authentication
class TestBZWorkflow(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=webdriver.DesiredCapabilities.HTMLUNIT)
$ ssh -vvvvvv USER@x.x.x.x
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug2: ssh_connect: needpriv 0
debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/HELPDESK/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/HELPDESK/.ssh/id_rsa type 1
debug1: identity file /home/HELPDESK/.ssh/id_rsa-cert type -1
debug1: identity file /home/HELPDESK/.ssh/id_dsa type -1
#!/usr/bin/expect
set ip [lindex $argv 0]
set timeout 3
spawn ssh -t login\@$ip 'su -c \"sh M13.1-15/list.sh\"'
expect "Password: $" { send "my_pass\n" }
set lineterminationChar "\r"