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
""" | |
kombu.syn | |
========= | |
:copyright: (c) 2009 - 2012 by Ask Solem. | |
:license: BSD, see LICENSE for more details. | |
""" | |
from __future__ import absolute_import |
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
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
my @fgColors = ( | |
'default', 'bold', 'black', 'red', 'blue', 'yellow', 'green', | |
'majenta', 'cyan', 'white', 'bold black', 'bold red', 'bold blue', | |
'bold yellow', 'bold green', 'bold majenta', 'bold cyan', 'bold white'); |
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
# install initd script | |
update-rc.d mysql-mirror defaults | |
# create user for mirror (avoid mirror use main server and vice-versa) | |
useradd -s /usr/sbin/nologin -r -M mysql-mirror | |
# create the run directory | |
install -m 755 -o mysql-mirror -g root -d /var/run/mysqld-mirror | |
# create the log directory |
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
#!/bin/bash | |
# http://cswarzone.com/ | |
# TODO: change the paths | |
cd /home/iuri/.local/share/wineprefixes/cs1.6/drive_c/Program\ Files\ \(x86\)/Counter-Strike/ | |
WINEPREFIX=/home/iuri/.local/share/wineprefixes/cs1.6/ exec \ | |
wine ./hl.exe \ | |
-steam \ | |
-game cstrike \ |
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
/************************************************************/ | |
/* DAR 10 para todo professor/aluno */ | |
var NOTA=10; | |
var selects = document.querySelectorAll("select[name^=p_]"); | |
for (var i=0; i < selects.length; i++) { | |
var s = selects[i]; | |
s.value = NOTA; | |
} | |
/* DAR 7 para todo professor/aluno */ |
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
def getattrfull(path): | |
""" | |
Obtem um atributo (objeto) de um caminho separado por '.', simulando um 'from xyz import y' | |
Exemplo para simular um 'from os import name as sistema': | |
>>> sistema = getattrfull('os.name') | |
>>> sistema | |
'posix' | |
Funciona para funcoes/classes/etc: |
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
from sqlalchemy import create_engine, Column, types | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker, scoped_session | |
from sqlalchemy.sql import functions, expression, func | |
from sqlalchemy.ext.compiler import compiles | |
from datetime import datetime | |
Base = declarative_base() |
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
var page = require('webpage').create(); | |
page.viewportSize = { width: 1280, height: 768}; | |
page.open('http://github.com/', function() { | |
page.render('github.png'); | |
phantom.exit(); | |
}); |
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
"use strict"; | |
var page = require('webpage').create(), | |
system = require('system'), | |
address, output, size, pageWidth, pageHeight; | |
if (system.args.length < 3 || system.args.length > 5) { | |
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); | |
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); | |
console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px'); | |
console.log(' "800px*600px" window, clipped to 800x600'); |
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
from __future__ import print_function | |
import sys | |
import inspect | |
def func(a, b, c, *args, **kwargs): | |
frame = inspect.currentframe() | |
args_names, _, _, locals_ = inspect.getargvalues(frame) | |
args = [locals_[i] for i in args_names] | |
kwargs = dict(zip(args_names, args)) | |
print ("kwargs: %r" %kwargs) |