Skip to content

Instantly share code, notes, and snippets.

View theclanks's full-sized avatar

Luis Carlos Otte Junior theclanks

View GitHub Profile
@theclanks
theclanks / gist:3054366
Created July 5, 2012 15:28 — forked from jollychang/gist:1048635
selenium and xvfb services @ gentoo
$ head -1000 /etc/conf.d/xvfb* /etc/init.d/{xvfb,selenium-daemon}
==> /etc/conf.d/xvfb <==
XVFB=/usr/bin/Xvfb
XVFBARGS=":90 -auth /etc/conf.d/xvfb.cfg -nolisten tcp"
PIDFILE=/var/run/xvfb.pid
==> /etc/conf.d/xvfb.cfg <==
localhost
==> /etc/init.d/xvfb <==
@theclanks
theclanks / _etc_conf.d_Xvfb
Created July 15, 2012 03:05
Xvfb on Gentoo
XVFB=/usr/bin/Xvfb
XVFBARGS=":100 -screen 0 1600x1200x24 -auth /etc/conf.d/Xvfb.cfg -nolisten tcp"
PIDFILE=/var/run/Xvfb.pid
from selenium import webdriver
from selenium.webdriver.remote.remote_connection import RemoteConnection
from selenium.webdriver.remote.errorhandler import ErrorHandler
from selenium.webdriver.remote.command import Command
class PersistentWebdriver (webdriver.Remote):
def __init__(self, session_id=None, browser_name=''):
command_executor='http://localhost:4444/wd/hub'
@theclanks
theclanks / firefox_selenium2
Created August 10, 2012 20:03
Problema Firefox - x86_64 - Selenium Webdriver
sudo mv /usr/lib/libX11.so.6 /usr/lib/libX11.so.6.old
sudo ln -s /usr/lib64/libX11.so.6.3.0 /usr/lib/libX11.so.6
@theclanks
theclanks / Yii - Grid com datas Brasil
Created November 12, 2012 18:15
Método para converter find no formato Brasil
private function converteData($value)
{
if($value != "" && preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/',$value,$matches))
return $matches[1] . date("Y-m-d",strtotime($matches[2]));
else
return $value;
}
@theclanks
theclanks / realloc_string.c
Created February 8, 2013 03:16
exemplo simples realloc
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(){
char *buffer = NULL;
char palavra;
printf("Alocando memoria\n");
--[[
$Id$
Copyright © 2007-2012 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@theclanks
theclanks / criptografia.php
Created October 10, 2013 21:15
Criptografia para PHP 5.3
<?
function encrypt($string, $key) {
$encryptionMethod = "AES-256-CBC";
$ivkey = sha1($key);
$iv = substr($ivkey, 0, 16);
return base64_encode(openssl_encrypt($string, $encryptionMethod, $key, 0, $iv));
}
@theclanks
theclanks / desk_stream.conf
Created December 10, 2013 14:10
Desktop Stream
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 100
MaxClients 100
MaxBandwidth 1500
CustomLog -
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
Match User gnub
ChrootDirectory %h
PasswordAuthentication yes
ForceCommand internal-sftp
PermitTTY no
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no