Skip to content

Instantly share code, notes, and snippets.

View theclanks's full-sized avatar

Luis Carlos Otte Junior theclanks

View GitHub Profile
Match User gnub
ChrootDirectory %h
PasswordAuthentication yes
ForceCommand internal-sftp
PermitTTY no
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
public function echo_memory_usage() {
$mem_usage = memory_get_usage(true);
if ($mem_usage < 1024)
echo $mem_usage." bytes";
elseif ($mem_usage < 1048576)
echo round($mem_usage/1024,2)." kb";
else
echo round($mem_usage/1048576,2)." mb";
echo "".PHP_EOL;
}
To set APM level:
camcontrol cmd ada0 -a "EF 05 00 00 00 00 00 00 00 00 xx 00"
To disable it:
camcontrol cmd ada0 -a "EF 85 00 00 00 00 00 00 00 00 00 00
To set AAM level:
camcontrol cmd ada0 -a "EF 42 00 00 00 00 00 00 00 00 xx 00"
To disable it:
camcontrol cmd ada0 -a "EF C2 00 00 00 00 00 00 00 00 00 00
@theclanks
theclanks / build.sh
Last active August 29, 2015 14:06 — forked from NicolasT/build.sh
#!/bin/bash -ue
# Dependencies (list might be incomplete):
# src/libevent-2.0.21-stable.tar.gz
# src/libsearpc (I used git f022c6509cff2eb604024c003eb60bcda975c0b1)
# src/ccnet (with Nicolas' patches, I used 3495a78466add16cfa9eddfb35a312bb9ce55264)
# src/seafile (with Nicolas' patches, I used 59eb918655dfa5f1328ec72be00681c6192f523d)
#
# Toolchain:
# vala (vala-0.18.1-1.fc18.x86_64)
Criar Branch:
mkdir branches/2.14.0
svn add branches/2.14.0
svn cp trunk/projeto branches/2.14.0/projeto
cd branches/
svn commit -m "Branch criada"
svn up
Merge do trunk para a branches com uma revisao:
@theclanks
theclanks / sel_custom_firefox.txt
Created November 26, 2014 18:10
Selenium - Webdriver Custom Firefox
wget https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/25.0/linux-i686/en-US/
profile = webdriver.FirefoxProfile("/compat/linux/opt/firefox/firefox-bin")
self.driver = webdriver.Firefox(profile)
.cshrc
setenv UNAME_v "FreeBSD 8.3-RELEASE #0: Sat Nov 29 11:15:09 BRST 2014 root@bsd:/usr/obj/usr/src/sys/GENERIC"
setenv UNAME_r 8.3-RELEASE
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/"
pkg_add -r bmake
cp /usr/bin/make /usr/bin/make.old
rm /usr/bin/make
ln -sv /usr/local/bin/bmake /usr/bin/make
@theclanks
theclanks / ssl_curl
Created January 21, 2015 11:48
SSL curl
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
@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 <==
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'