Skip to content

Instantly share code, notes, and snippets.

http://www.bentedder.com/using-mysql-workbench-with-vagrant/
@supwr
supwr / mysqladmin
Created September 15, 2017 12:31
Get mysql stats inside of ubuntu
mysqladmin -u root -proot extended-status processlist
@supwr
supwr / install-mongodb-driver-on-php7.txt
Last active September 10, 2017 02:22
Install mongodb driver on PHP7
- sudo apt-get install php-pear
- sudo apt-get install php7.0-dev
- sudo apt-get install libcurl3-openssl-dev
- sudo pecl install mongodb
- add "extension=mongodb.so" to php.ini on both apache2 and cli folders
@supwr
supwr / niveis de log.txt
Last active September 4, 2017 18:16
Niveis de Log
=> Debug
=> Info (interação do usuário, hit de api)
=> Notice (eventos comuns, eventos relevantes)
=> Warning (eventos que fogem do comum, não sendo erros, mas relevantes ao sistema)
=> Error (erro em tempo de execução)
=> Critical (falha de serviços externos)
=> Alert (erros que precisam de ação corretiva imediata)
=> Emergency (sistema em estado inativo)
apt-get update
apt-get install -y apache2
if ! [ -L /var/www/html ]; then
rm -rf /var/www/html
ln -fs /vagrant/html /var/www/html
fi
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php7.0
<?
$pdo = new PDO('mysql:hostlocalhost;dbname=linhas_santos','root','');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec("set names utf8");
$pagina = "http://www.cetsantos.com.br/transportes/linha04.htm";
@supwr
supwr / content_home.xml
Created February 3, 2016 16:14
Linear layout com texto, botão
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
@supwr
supwr / phploc.py
Last active August 29, 2015 14:20
import sublime, sublime_plugin
import datetime
import subprocess
import os
class PhplocCommand(sublime_plugin.TextCommand):
# Class created to consume Sebastian Bergmann's PHPLOC
# from SublimeText
import sublime, sublime_plugin
import datetime
import subprocess
import os
class HelloCommand(sublime_plugin.TextCommand):
def run(self, edit):
arquivo = self.view.file_name()
@supwr
supwr / countdown.php
Created April 13, 2015 12:24
Print 100 to 1. Using code starting with "for($i=0", without anything before "for($i=0" and without using any loop inside this "for" code block. Read this challenge as a part of an article written on the site DevBattles.com(http://www.devbattles.com/en/sand/post-1038-Why+can%27t+programmers+program)
<?php
for($i=0;$i < 100;$i++){
echo ($i - 100)*(-1)."<br>";
}
?>