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
# helper para trocar a posição de dois itens em um array | |
def switch(items, posX, posY): | |
temp = items[posX] | |
items[posX] = items[posY] | |
items[posY] = temp | |
return items | |
# operação de partição. retorna a lista particionada | |
# o último parâmetro (opcional) diz qual será o pivô, se | |
# não especificado, será right/2. |
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
// este programa é um exemplo; ele não deve ser compilado. | |
public class Book { | |
public String title; | |
public String author; | |
public int totalPages; | |
public int currentPage; | |
public Book(String title, String author, int pages){ |
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 | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' |
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
void insere(struct No_Processo* elemento, struct No_Processo* fila){ | |
struct No_Processo *atual = fila; | |
// vai até o último elemento | |
while(atual->proximo != 0){ | |
atual = atual->proximo; | |
} | |
// adiciona um novo último elemento | |
atual->proximo = (struct No_Processo*) malloc(sizeof(struct No_Processo)); | |
atual = atual->proximo; | |
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
-- Atualiza o endereço de uma instalação do Wordpress. | |
-- Útil para migrar um site do Wordpress usando dumps/exportações de SQL ao invés das ferramentas do próprio WP. | |
-- Não funciona em instalações com múltiplos sites (WP Network). | |
-- 1. Exporte o banco de dados do seu site em Wordpress - por exemplo, usando o "export" do phpmyadmin. | |
-- 2. Carregue-o no banco de dados de destino - por exemplo, usando o "import" do phpmyadmin. | |
-- 3. Na janela "query" do phpmyadmin (ou similar), cole o código completo deste arquivo. | |
-- 4. Note um endereço na última linha, entre aspas. Altere-o para o endereço do site novo. | |
-- - o endereço deve começar 'http://' ou similar. | |
-- - o endereço NÃO deve ter uma barra no final. |
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 | |
cd ~ | |
# clona o repositório problemático | |
git clone repo test_repo | |
cd test_repo | |
# git status mostrará arquivos deletados, mesmo o repositório tendo acabado de ser clonado/checkoutado. | |
# ls mostrará que de fato os arquivos não existem, também. | |
git status | |
# checkout, reset | |
git checkout . |
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
Total battles: 126224 | |
Avg. weight/team: 0.597 | |
+ ---- + ------------------ + --------- + ------ + ------- + ------ + ------- + | |
| Rank | Pokemon | Usage % | Raw | % | Real | % | | |
+ ---- + ------------------ + --------- + ------ + ------- + ------ + ------- + | |
| 1 | Xerneas | 47.80935% | 101356 | 40.149% | 75036 | 39.484% | | |
| 2 | Mewtwo | 38.25590% | 86308 | 34.188% | 61171 | 32.188% | | |
| 3 | Arceus | 30.56546% | 55961 | 22.167% | 41446 | 21.809% | | |
| 4 | Kyogre | 29.61674% | 59207 | 23.453% | 45124 | 23.744% | | |
| 5 | Darkrai | 20.81928% | 51963 | 20.584% | 39476 | 20.772% | |
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
[color] | |
ui = true | |
status = auto | |
branch = auto | |
pager = true | |
diff = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow |
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 // coloque isso no functions.php | |
/** | |
* Emulates Ruby/Phyton yield() behavior. | |
* usefull for construncting loops with function callbacks on each element. | |
* receives a callable thing on construction. | |
* Author: Matheus E. Muller (hello at memuller dot com) | |
* Version: 11.12.07, alpha | |
* License: Distributed under the MIT License. | |
*/ |
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
require 'mysql' | |
begin | |
db = Mysql.real_connect 'localhost', 'root' , 'alpha13' | |
databases_hash = {} | |
db.query("show databases ;").each do |database| | |
databases_hash.merge!( { database[0] => [] } ) | |
end | |
databases_hash.each do |k, v| | |
db.select_db k |